JSPM

@tinyhttp/app

0.5.23
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 177539
  • Score
    100M100P100Q159848F
  • License MIT

0-legacy, tiny & fast web framework as a replacement of Express

Package Exports

  • @tinyhttp/app
  • @tinyhttp/app/package.json

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(function ware(req: Request, res: Response, next: NextFunction) {
    console.log('Did a request')
    next()
  })
  .get('/', (_, res) => void res.send('<h1>Hello World</h1>'))
  .get('/page/:page', (req, res) => void res.status(200).send(`You opened ${req.params.page}`))
  .listen(3000)

License

MIT © v1rtl