@tunframework/tun-statics
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

tun-rest-router

handle statoc files for tun

install

npm install @tunframework/tun{,-bodyparser,-rest-router,-statics}

example

import { TunApplication } from '@tunframework/tun'
import { statics } from '@tunframework/tun-statics'
import { resolve } from 'path'

const __dirname = resolve(process.cwd(), 'statics')

const app = new TunApplication()
app.use(statics({ dir: __dirname, prefix: '/statics' }))

const server = app.listen({ host: '127.0.0.1', port: 0 })

server.on('listening', async () => {
  // @type {AddressInfo}
  let addr = server.address() || {}
  console.log(`listening: http://${addr.address}:${addr.port}`)
})

Package Sidebar

Install

npm i @tunframework/tun-statics

Weekly Downloads

51

Version

2.0.2

License

ISC

Unpacked Size

13.5 kB

Total Files

6

Last publish

Collaborators

  • cn-ia