1. @tinyhttp/app
0-legacy, tiny & fast web framework as a replacement of Express
@tinyhttp/app
Package: @tinyhttp/app
Created by: tinyhttp
Last modified: Sat, 06 Jan 2024 22:18:43 GMT
Version: 2.2.3
License: MIT
Downloads: 333,810
Repository: https://github.com/tinyhttp/tinyhttp

Install

npm install @tinyhttp/app
yarn add @tinyhttp/app

@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)

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code