GithubHelp home page GithubHelp logo

himujjal / tinyhttp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tinyhttp/tinyhttp

0.0 0.0 0.0 6.78 MB

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

Home Page: https://tinyhttp.v1rtl.site

License: MIT License

TypeScript 72.53% JavaScript 2.60% HTML 10.62% CSS 14.23% Shell 0.02%

tinyhttp's Introduction

tinyhttp

⚡ Tiny web framework as a replacement of Express

npm npm type definitions GitHub Workflow Status Codecov Vulnerabilities Codacy grade All Contributors Last commit NPM

⚠ The project is in development. Please don't use in production.

tinyhttp is a modern Express-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:

  • 2.5x faster 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

To get started, visit tinyhttp website.

Install

tinyhttp requires Node.js 12.4.0 or newer. It is recommended to use pnpm, although it isn't required.

# npm
npm i @tinyhttp/app
# pnpm
pnpm i @tinyhttp/app
# yarn
yarn add @tinyhttp/app

Docs

You can see the documentation here.

Get Started

The app structure is quite similar to Express, except that you need to import App from @tinyhttp/app instead of default import from express.

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('<h1>Hello World</h1>')
  })
  .get('/page/:page/', (req, res) => {
    res.status(200).send(`You just opened ${req.params.page}`)
  })
  .listen(3000)

For more examples, check examples folder.

Middlewares

tinyhttp offers a list of premade middleware for common tasks.

Search and explore the full list at middleware search page.

Comparison

To compare tinyhttp with Express and Polka (another Express-like framework), see COMPARISON.md

Benchmarks

To see benchmark comparison between tinyhttp, polka and express, check benchmark folder.

Contributing

See CONTRIBUTING.md.

License

MIT © v1rtl

Contributors ✨

Thanks goes to these wonderful people (emoji key):


v 1 r t l

💡 🔌 📆 🚧 💻

Matt

🔌

Nasmevka

📖

elianiva

💡 🚧 💻 ⚠️

Katja Lutz

💡

Arnovsky

🔌 💻

Rocktim Saikia

🚇 💻 💡

Ahmad Reza

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Supporters 💰

These amazing people supported tinyhttp financially:


molefrog

tinyhttp's People

Contributors

allcontributors[bot] avatar elianiva avatar arnovsky avatar rocktimsaikia avatar bra1l0r avatar ahmad-reza619 avatar katywings avatar betelgeuse1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.