@otterhttp/app
v3.4.9
Published
0-legacy, tiny & fast web framework as a replacement of Express
Downloads
435
Maintainers
Readme
@otterhttp/app
The core of tinyhttp. Contains the App
, Request
and Response
. Additionally, it provides special tinyhttp-specific types.
Install
pnpm i @otterhttp/app
Example
import { App } from '@otterhttp/app'
import type { Request, Response, NextFunction } from '@otterhttp/app'
new App()
.use((req: Request, res: Response, next: NextFunction) => {
console.log('Did a request')
next()
})
.get('/', (_, res) => res.send('<h1>Hello World</h1>'))
.get('/page/:page', (req, res) => res.send(`You opened ${req.params.page}`))
.listen(3000)