Package Exports
- @tinyhttp/app
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tinyhttp/app) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@tinyhttp/app
The core of tinyhttp. Contains the App
, Request
and Response
. Additionally, it provides special tinyhttp-specific types.
Install
pnpm i @tinyhttp/app
Example
import { App } from '@tinyhttp/app'
import type { Request, Response, NextFunction } from '@tinyhttp/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)