@tunframework/tun
Version:
tun framework for node with typescript
30 lines (20 loc) • 489 B
Markdown
tun framework for node with typescript
```sh
npm install @tunframework/tun
```
```js
import { TunApplication } from '@tunframework/tun'
const app = new TunApplication()
app.use(async (ctx, next) => {
return `Hi, world!`
})
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}`)
})
```