# tinyhttp **Repository Path**: studvc/tinyhttp ## Basic Information - **Project Name**: tinyhttp - **Description**: πŸ¦„ 0-legacy, tiny & fast web framework as a replacement of Express - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-01-31 - **Last Updated**: 2021-01-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![](https://tinyhttp.v1rtl.site/cover.jpg)

tinyhttp

⚑ Tiny web framework as a replacement of Express

[![](https://img.shields.io/badge/website-visit-hotpink?style=flat-square)][site-url] [![npm](https://img.shields.io/npm/dm/@tinyhttp/app?style=flat-square)][npm-url] [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/talentlessguy/tinyhttp/CI?style=flat-square)][github-actions] [![Codecov](https://img.shields.io/codecov/c/gh/talentlessguy/tinyhttp?style=flat-square)][codecov] ![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/@tinyhttp/app.svg?style=flat-square) [![Codacy grade](https://img.shields.io/codacy/grade/239a8cc7bca24042940f018a1ccec72f?style=flat-square)][codacy-url] [![Last commit](https://img.shields.io/github/last-commit/talentlessguy/tinyhttp.svg?style=flat-square)][gh-url] [![NPM](https://img.shields.io/npm/l/@tinyhttp/app?style=flat-square)][license] _**tinyhttp**_ is a modern [Express](https://expressjs.com/)-like web framework written in TypeScript and compiled to native ESM, that uses a bare minimum amount of dependencies trying to avoid legacy hell. Here is a short list of most important features that tinyhttp has: - ⚑ [2x faster](benchmark) than Express - βš™ Full Express middleware support - β†ͺ Async middleware support - β˜‘ Native ESM and CommonJS support - πŸš€ No legacy dependencies, just the JavaScript itself - πŸ”¨ Types out of the box - πŸ”₯ Prebuilt middleware for modern Node.js Visit [tinyhttp website](https://tinyhttp.v1rtl.site) for docs, guides and middleware search. ## Install tinyhttp requires [Node.js 12.4.0 or newer](https://node.green/#ES2019). It is recommended to use [pnpm](https://pnpm.js.org/), although it isn't required. ```sh # npm npm i @tinyhttp/app # pnpm pnpm i @tinyhttp/app # yarn yarn add @tinyhttp/app ``` ## Docs You can see the documentation [here](https://tinyhttp.v1rtl.site/docs). ## Get Started tinyhttp is compiled to ESM (and legacy CommonJS) so you can use `import` / `export` syntax in Node.js with it. To setup a Node ESM package, put `"type": "module"` in the package.json file, like this: ```json { "type": "module" } ``` Another option would be using an `.mjs` extension, then you don't need to put that `"type"` field in package.json. For more info, check out the [ECMAScript Modules Node.js documentation](https://nodejs.org/api/esm.html). From now on you can use named imports for ESM modules and default imports for CommonJS modules in your project. The app structure is quite similar to Express, except that you need to import `App` from `@tinyhttp/app` instead of default import from `express`. ```ts import { App } from '@tinyhttp/app' import { logger } from '@tinyhttp/logger' const app = new App() app .use(logger()) .use(function someMiddleware(req, res, next) { console.log('Did a request') next() }) .get('/', (_, res) => { res.send('

Hello World

') }) .get('/page/:page/', (req, res) => { res.status(200).send(`You just opened ${req.params.page}`) }) .listen(3000) ``` See tinyhttp ["Learn" page](https://tinyhttp.v1rtl.site/learn) for complete guide. ## Middlewares tinyhttp offers a list of premade middleware for common tasks, such as [session](https://tinyhttp.v1rtl.site/mw/session), [logger](https://tinyhttp.v1rtl.site/mw/logger) and [jwt](https://tinyhttp.v1rtl.site/mw/jwt). Search and explore the full list at [middleware search page](https://tinyhttp.v1rtl.site/mw). ## Comparison See [COMPARISON.md](COMPARISON.md). ## Benchmarks Check [benchmark](benchmark) folder. ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md). ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

v 1 r t l

πŸ’‘ πŸ”Œ πŸ“† 🚧 πŸ’»

Matt

πŸ”Œ ⚠️

Nasmevka

πŸ“–

elianiva

πŸ’‘ 🚧 πŸ’» ⚠️

Katja Lutz

πŸ’‘

Arnovsky

πŸ”Œ πŸ’»

Rocktim Saikia

πŸš‡ πŸ’» πŸ’‘

Ahmad Reza

πŸ’»

Ionel lupu

πŸ’‘

Tomi Kalmi

πŸ“–

Luiginator

πŸ’‘ πŸ’»

Aneesh Relan

πŸ’‘ ⚠️

Roberto Ortega

πŸ’‘

Barciet MaΓ«lann

πŸ’‘

shzmr

πŸ’» ⚠️ πŸ’‘

Egor Avakumov

πŸ’‘

Rashmi K A

πŸ’»

Shubhi Agarwal

⚠️

Maurizio

⚠️ πŸ’»

jkreller

πŸ’‘

Alan Carpilovsky

⚠️

KoljaTM

⚠️

ike

πŸ“– πŸ’‘

Fabian MorΓ³n Zirfas

πŸ›

Vitaly Baev

⚠️ πŸ›

omrilotan

πŸ’» πŸ“–

MVEMCJSUNPE

πŸ’‘ πŸ›

Leo Toneff

πŸ’»

Calum Knott

πŸ“– πŸ›
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! ## Supporters πŸ’° These amazing people supported tinyhttp financially:

molefrog
## License MIT Β© [v1rtl](https://v1rtl.site) [site-url]: https://tinyhttp.v1rtl.site [npm-url]: https://npmjs.com/package/@tinyhttp/app [codecov]: https://codecov.io/gh/talentlessguy/tinyhttp [github-actions]: https://github.com/talentlessguy/tinyhttp/actions [license]: https://github.com/talentlessguy/tinyhttp/blob/master/LICENSE [gh-url]: https://github.com/talentlessguy/tinyhttp [codacy-url]: https://www.codacy.com/manual/talentlessguy/tinyhttp