๐Ÿฆ„ 0-legacy, tiny & fast web framework as a replacement of Express

Overview

tinyhttp

โšก Tiny web framework as a replacement of Express

npm GitHub Workflow Status Codecov Vulnerabilities Codacy grade Last commit NPM

๐Ÿฆ• tinyhttp now has a Deno port (work in progress)

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:

  • โšก 2x 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
  • ๐Ÿ”ฅ Prebuilt middleware for modern Node.js

Visit tinyhttp website for docs, guides and middleware search.

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

Create a new project using tinyhttp CLI:

pnpm i -g @tinyhttp/cli

tinyhttp new basic my-app

cd my-app

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)

See tinyhttp "Learn" page for complete guide.

Middlewares

tinyhttp offers a list of premade middleware for common tasks, such as session, logger and jwt.

Search and explore the full list at middleware search page.

Comparison

See COMPARISON.md.

Benchmarks

Check benchmark folder.

Contributing

See CONTRIBUTING.md.

Contributors โœจ

Thanks goes to these wonderful people (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

๐Ÿ“– ๐Ÿ›

Reinaldy Rafli

๐Ÿ’ป ๐Ÿ›

Ganesh Pendyala

๐Ÿ“–

Maxim

๐Ÿ›

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

Sponsors ๐Ÿ’ฐ


Deta

molefrog

Carrots

Donate

PayPal ko-fi Qiwi Yandex Money

Bitcoin Ethereum ChainLink

License

MIT ยฉ v1rtl

Comments
  • Router methods hang if one is called after another

    Router methods hang if one is called after another

    'm having trouble with my custom async middleware...It seems to hang on loading the POST request and the logger middleware doesnt print anything related to that request. It also seems to block any app.use() lines after the line that is cuasing it to hang, which causes 404 to not work. I'm not sure what the problem is with my code (im using async/await with bcrypt and mongodb) but it shouldnt block other methods after it? What's weird is that app.get() lines that are BEFORE the problematic line work totally fine. I'll post my code here if needed but I'm not sure what is causing it to hang. I'm pretty sure ive handled all the errors AND changed some of the functions to async functions. I also checked that I'm sending a response with res.json() or res.send() so its not that im not sending anything...

    heres my middleware file: https://hastebin.com/ifocicitem.js and heres where i use it: https://hastebin.com/juhovowuvo.coffeescript

    bug core 
    opened by theoparis 25
  • Write tests for `@tinyhttp/jsonp`

    Write tests for `@tinyhttp/jsonp`

    Express tests: https://github.com/expressjs/express/blob/master/test/res.jsonp.js

    Should be put in __tests__/modules/jsonp.ts

    No need to write as many tests as in Express, if it hits 100% coverage, it's enough

    good first issue tests easy 
    opened by talentlessguy 15
  • ETag caching not working

    ETag caching not working

    Issuehunt badges

    Describe the bug

    With cache enabled in the browser: with browser-side cache enabled Without cache enabled in the browser: without browser-side cache enabled Both send a 200 and the data.

    To Reproduce

    Steps to reproduce the behavior:

    1. Initialize App with freshnessTesting set to true
    import { App } from "@tinyhttp/app";
    new App({
        settings: {
            freshnessTesting: true
        }
    })
        .get("/", (_, res) => res.send("Things"))
        .listen(8080, () => console.log("Listening on port 8080"));
    
    1. Open localhost:8080 in the browser
    2. Refresh
    3. Both requests sent got HTTP code 200, even though they both have the same ETag

    Expected behavior

    tinyhttp sends a 304 not modified code on the refresh, so the browser gets it from it's cache.

    Versions

    • node: 16.3.0
    • @tinyhttp/app: 1.3.8

    IssueHunt Summary

    Backers (Total: $0.00)

    Become a backer now!

    Or submit a pull request to get the deposits!

    Tips

    bug help wanted core pkg: send 
    opened by tbhmens 13
  • Test `@tinyhttp/session`

    Test `@tinyhttp/session`

    tests are almost identical to Express session module, so there are references to source of their tests.

    • [ ] SessionManager(opts)
      • [ ] more coming soon....
    • [ ] getSession(req, res)
      • [x] session.save(cb)
        • [x] Should save session to store (src)
        • [x] Should prevent end-of-request save (src)
        • [x] Should prevent end-of-request save on reloaded session
      • [x] session.touch(cb) (src)
      • [ ] session.cookie (src)
      • [x] session.originalMaxAge (src)
      • and the rest of session properties :D
    • [ ] Cookie
      • [ ] new Cookie(opts)
        • [x] expires is falsy be default
        • [x] httpOnly is true by default

    this list is in progress, so pls ping once finished writing those tests

    tests easy pkg: session 
    opened by talentlessguy 13
  • Add badges option to @tinyhttp/logger

    Add badges option to @tinyhttp/logger

    Is your feature request related to a problem? Please describe.

    It adds emoji badges for better readability

    Describe the solution you'd like

    Add badges setting with 2 sub-settings to be used like this:

    app.use(logger({ badges: { emoji: true, captions: false }))
    

    Default values are both false - if badges: true - only toggle emoji. if an object is present - check for the settings.

    first setting toggles emoji badges, like this :warning: second enables emoji alt text (in case emoji fails to display or just prefer the text instead), like this: warning

    here's a table of emoji / texts:

    | emoji | text | status code | |-----|-------|----------------| | :x: | Error | 500 | | :warning: | status message | 4XX (Except 404) | | :ok: | OK | 2XX | | :mag_right: | Not Found | 404 |

    Should be logged in the beginning:

    ๐Ÿ†— GET 200 OK /css/shared.css
    

    Additional context

    Zoya logger that has emoji:

    image

    enhancement good first issue middleware logger 
    opened by talentlessguy 13
  • App.use does not alter request path for middleware

    App.use does not alter request path for middleware

    Describe the bug

    The sirv or serve-static middleware does not serve files when putting it under another path in the router. It does work when the mount path is / or corresponds with the filesystem.

    To Reproduce

    import { App } from "@tinyhttp/app";
    import serveStatic from "serve-static";
    import sirv from "sirv";
    
    new App()
      .use("/static", sirv("dist/client"))
      .use("/static2", serveStatic("dist/client"))
      .use("/pages", sirv("dist/client"))
      .listen(3000);
    
    
    $ curl http://localhost:3000/static/pages/index.js
    Not found
    $ curl http://localhost:3000/static2/pages/index.js
    Not found
    $ curl http://localhost:3000/pages/index.js
    console.log("hi");
    
    

    Expected behavior

    $ curl http://localhost:3000/static/pages/index.js
    console.log("hi");
    $ curl http://localhost:3000/static2/pages/index.js
    console.log("hi");
    $ curl http://localhost:3000/pages/index.js
    Not found
    

    Versions

    • node: v14.13.0
    • @tinyhttp/app: ^1.0.14

    Additional context

    $ tree dist/client
    dist/client
    โ””โ”€โ”€ pages
        โ”œโ”€โ”€ index.js
        โ”œโ”€โ”€ index.js.map
        โ”œโ”€โ”€ outdex.js
        โ””โ”€โ”€ outdex.js.map
    
    bug 
    opened by ewired 12
  • Create search example

    Create search example

    Create a server-side Google-like search, similar to Express search example

    example folder: search

    Redis can be used, although it isn't a necessity

    a simple array will also work

    a bonus point would be making a cool layout for it (google clone but w/ tinyhttp logo idk) :D

    good first issue examples easy 
    opened by talentlessguy 12
  • Heroku don't work with tinyhttp

    Heroku don't work with tinyhttp

    Describe the bug

    I write a simple web service using tinyhttp and i decided to deploy on heroku. but guess what, heroku don't compatible with tinyhttp. when i replaced tinyhttp with express, everything works fine.

    To Reproduce

    Steps to reproduce the behavior:

    1. write webservice
    2. add Procfile
    3. set web: yarn start
    4. git add -A
    5. git push heroku master

    Expected behavior

    Working Fin!

    Versions

    • node: 14
    • @tinyhttp/app: 0.4.1

    Additional context

    bug help wanted 
    opened by mhmda-83 12
  • 404 when passing more than 1 middleware to app.method

    404 when passing more than 1 middleware to app.method

    Sooooo, I am having a new issue: the first response gives an actual error/result (which is expected), but on the second request it responds with my 404 noMatchHandler.. It doesn't matteer what the url is on the second request, it just sends the 404 and then complains the headers are already sent.

    bug core 
    opened by theoparis 12
  • I get this error when using typescript example.

    I get this error when using typescript example.

    francel@francel-Inspiron-N5010:~/Images/typescript$ npm start

    start node --experimental-loader ts-node/esm --experimental-specifier-resolution=node index.ts

    (node:25298) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) internal/modules/cjs/loader.js:889 const err = new Error(message); ^

    Error: Cannot find module 'typescript' Require stack:

    • /home/francel/Images/typescript/node_modules/ts-node/dist/index.js
    • /home/francel/Images/typescript/node_modules/ts-node/dist/esm.js
    • /home/francel/Images/typescript/node_modules/ts-node/esm.mjs at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.resolve (internal/modules/cjs/helpers.js:98:19) at loadCompiler (/home/francel/Images/typescript/node_modules/ts-node/dist/index.js:163:34) at create (/home/francel/Images/typescript/node_modules/ts-node/dist/index.js:170:28) at Object.register (/home/francel/Images/typescript/node_modules/ts-node/dist/index.js:139:21) at Object.registerAndCreateEsmHooks (/home/francel/Images/typescript/node_modules/ts-node/dist/esm.js:22:36) at file:///home/francel/Images/typescript/node_modules/ts-node/esm.mjs:11:9 at ModuleJob.run (internal/modules/esm/module_job.js:170:25) at async Loader.import (internal/modules/esm/loader.js:178:24) at async internal/process/esm_loader.js:57:9 { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/francel/Images/typescript/node_modules/ts-node/dist/index.js', '/home/francel/Images/typescript/node_modules/ts-node/dist/esm.js', '/home/francel/Images/typescript/node_modules/ts-node/esm.mjs' ] } francel@francel-Inspiron-N5010:~/Images/typescript$
    bug help wanted 
    opened by francelwebdev 11
  • Subapp overrides all paths, even the ones from original app

    Subapp overrides all paths, even the ones from original app

    Describe the bug

    When a subapp is mounted on a path, all of the middlewares with the same path in the original app are ignored and return 404 because it's being handled by a subapp.

    To Reproduce

    import { App } from '@tinyhttp/app'
    import serveStatic from 'serve-static'
    import sirv from 'sirv'
    import path from 'path'
    
    const app = new App()
    
    const subapp = new App()
    
    subapp.get('/',(req, res) => res.send('hello world'))
    
    
    app.use('/', sirv('public'))
    app.use('/', subapp)
    
    app.listen(3000)
    
    $ curl localhost:3000
    hello world
    $ curl localhost:3000/hello.txt
    Not Found
    

    Expected behavior

    If subapp couldn't find the handler with the request path, the original middleware should handle it instead.

    $ curl localhost:3000
    hello world
    $ curl localhost:3000/hello.txt
    I am a file
    

    Versions

    • node: 15.4.0
    • @tinyhttp/app: 1.1.0

    Additional context

    #203

    bug help wanted core 
    opened by talentlessguy 11
  • Add declarationMap:true to tsconfig for correct ctrl-click go-to-source

    Add declarationMap:true to tsconfig for correct ctrl-click go-to-source

    Currently, ctrl+click on a tinyhttp export from VS Code goes to the .d.ts file instead of going to the function source code. Adding "declarationMap": true to tsconfig.json would generate .js.map files. For example, take a look here https://github.com/wingedrhino/node-pipespawn/tree/master/dist

    I'd love to add this to tinyhttp, but every other package that's been moved to its own dedicated repository would also need to be updated for this to be actually useful.

    If you're happy to accept merge requests, I can start submitting them one at a time!

    enhancement 
    opened by wingedrhino 2
  • Fix: Issue #351 default server host compatibility with IPv6

    Fix: Issue #351 default server host compatibility with IPv6

    Closes #351 by un-defining the default server host name and adds a new test which passes on dual-stack machines.

    Sadly, this may not be testable on GitHub due to actions/virtual-environments#668.

    opened by Barnabas 1
  • Default server host not compatibile with IPv6

    Default server host not compatibile with IPv6

    Describe the bug

    If you create a basic server and don't specify an address to bind to, the server will bind to 0.0.0.0. On an OS with both IPv4 and IPv6, this may mean it will reject requests to localhost.

    To Reproduce

    Steps to reproduce the behavior:

    1. install and run the basic example
    2. open http://localhost:3000 in a browser, see "Hello World" message.
    3. http://127.0.0.1:3000/ works too.
    4. open http://[::1]:3000/ (IPv6 loopback address) - fails

    Expected behavior

    You should see the same "Hello World" in all cases. A server without a specified host should listen on all available interfaces.

    Workaround: change line 25 of index.js to this:

    .listen(3000, () => console.log(`Listening on http://localhost:3000`), "::")
    

    Versions

    • node: 17.6.0
    • @tinyhttp/app: 2.0.19

    Additional context

    I personally found this while trying to use tinyhttp to power the API backend for a Vite frontend, and doing local testing using Vite's built-in proxy. The frontend was running on http://localhost:3000 and the backend was using http://localhost:3001. Accessing both services through a browser was fine, and also running the whole stack inside of docker compose was OK too. But on my MacBook (macOS 12.2.1) using Node v17.6.0, attempts to proxy to the backend resulted in this error:

    Error: connect ECONNREFUSED ::1:3001
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1158:16)
    

    ...until I changed the app.listen line in my server to add the last argument with the value "::".

    app.listen(PORT, () => console.log("Started on http://localhost:" + PORT), "::");
    

    It turns out that a blank string "" also works. On my machine at least, IPv6 seems to have higher priority than IPv4. AFAICT, this behavior appears to have been changed in GH-86 to fix #85. According to the relevant Node documentation for server.listen:

    If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise. In most operating systems, listening to the unspecified IPv6 address (::) may cause the net.Server to also listen on the unspecified IPv4 address (0.0.0.0).

    This suggests that in addition to the workaround above (that is, using host value "::" instead of "0.0.0.0"), perhaps omitting the host by making the default host an empty string is the right call, and let Node sort it out.

    The reasoning behind dual-stack interface binding is discussed further in nodejs/node#9390.

    By the way, great library and documentation. Thanks for your work on this over the years.

    bug 
    opened by Barnabas 2
  • Deno support

    Deno support

    Now that @tinyhttp/router v1.0.5+ no longer depends on http module of Node.js, it should be very easy to implement basic Deno support for tinyhttp. Probably it would be cool to have it located in the separate deno folder with all editor settings specifically for it.

    There aren't strict requirements on how it should be implemented, but i suppose we need to use either raw gh links, jspm or skypack to import the router

    and we should use Deno's std http lib to pass request and response as generics, e.g. smth like this:

    import { Router } from 'https://...'
    import { ServerRequest } from 'https://...'
    
    export class App extends Router<ServerRequest, ...> {
     // ...
    }
    

    so it works instantly

    enhancement help wanted good first issue medium 
    opened by talentlessguy 1
  • NestJS adapter

    NestJS adapter

    Is your feature request related to a problem? Please describe.

    An adaper for Nest will let you use tinyhttp inside of Nest instead of Express.

    Describe the solution you'd like

    A Nest.js adapter package, something like @tinyhttp/nest-adapter

    Additional context

    Please pull request to this repository

    enhancement help wanted good first issue new package medium 
    opened by talentlessguy 23
  • Create RealWorld application

    Create RealWorld application

    Create a real-world application, a Medium clone, according to this repo spec

    Stack:

    | tool | name | |------------|-----------------------------| | web framework | tinyhttp (obv) | | body parser | milliparsec | | database | PostgreSQL | | ORM (ik it's not but it's easier to call it like this) | Prisma | | auth | JWT (w/ @tinyhttp/jwt) | | cors | @tinyhttp/cors | | unit tests | uvu + supertest-fetch |

    The whole code must be in a separate repository and the PR only needs to include a link to that repository.

    example readme:

    RealWorld

    Example tinyhttp Medium clone following the RealWorld spec.

    Check the node-tinyhttp-realworld-example-app repository.

    p.s.: after completing an example, either me or the one who made the repo should open an issue to realworld repo and after that, submit a PR

    good first issue examples hard hacktoberfest 
    opened by talentlessguy 15
Releases(@tinyhttp/[email protected])
  • @tinyhttp/[email protected](Aug 22, 2021)

    Slide 16_9 - 18

    tinyhttp v2 - Hello ESM, goodbye CJS

    tinyhttp finally drops all CommonJS outputs and becomes pure ESM. Node.js 10 became EOL so this means all LTS versions starting v12 support the framework. All of the middlewares are also pure ESM now.

    Core

    • BREAKING: move to pure ESM
    • fix: Unable to set url prefix for the application (#249)
    • remove freshnessTesting property because it makes no sense
    • router: align RegexParams types to regexpram
    • fix: console.error triggering in tests
    • don't report error if it is not an Error class instance
    • set proper headers for HEAD requests
    • fix: ETag caching not working (#272)
    • send: set 304 status on fresh request
    • fix: req.path computed improperly (#290)
    • fix: router mount order (#292)
    • fix(send): res.sendFile method forcibly overwrites the HTTP status code with 200

    Wares

    • cors: set default allowed headers to content-type (#257)
    • fix(logger): statusEmoji import in logger (#271)
    • deprecate @tinyhttp/session, @tinyhttp/pug
    • move bot-detector, cookie-parser, jwt, logger, favicon, markdown to separate repos
    • ip-filter, rate-limit: remove type dependency on tinyhttp in wares

    Other

    • cli: add project name as package.json name (#264)

    Docs

    • fix typo in couchdb/README.md (#251)
    • fix broken benchmarks link (#300)
    • rate-limit: Correct status code typo (#303)
    • move website to a separate repo

    Examples

    • add turbo-http, neo4j (#269), malibu (#281), swagger (#283) examples
    • use ts-node/esm loader for ts example
    • remove aws, babel, next-custom-server, dev-server examples bc of incompatibility with ESM
    • examples cleanup & deps bump

    thanks to @wasd845, @tbhmens, @fabiospampinato, @sbencoding, @e965, @n1ru4l, @paolotiu, @eltociear, @sonnyp, @aral, @wakeupmh, @aldy505, @massivefermion for helping with the project! โค๏ธโค๏ธโค๏ธ

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Apr 26, 2021)

    Core

    • added missing acceptsLanguages method in Request interface

    Wares

    • @tinyhttp/favicon - Convert to sync for better compat

    Docs

    • typo fixes
    • added section about transpilation to older Node.js versions
    • added Deta to ways of deploying a tinyhttp app

    Examples

    • added Deta example

    Other

    • send: Range header support for sendFile
    • send: Set Content-Encoding and Last-Modified headers for sendFile
    • router: - Simplify router code by using a generic .add(...) method
    • router: Support arrays for route handlers (https://github.com/talentlessguy/tinyhttp/issues/65)
    • send: added caching support to sendFile
    • cookie: default req.signedCookies to {}
    • req: fix req.fresh not getting set
    • core: fix HEAD not being set implicitly (https://github.com/talentlessguy/tinyhttp/issues/243)
    • core/router: add params support for subapp mountpaths (https://github.com/talentlessguy/tinyhttp/issues/242)
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Feb 21, 2021)

    v1.2 CLI and initial Deno support

    Core

    • Add custom xPoweredBy setting (3ff78610646ab3c58451f900ea0bf6a3c54acfc0)
    • Fix 404 with query parameters (80dd71c5d1986b0d78b5fba517587ba214a9212c)
    • Align types to be identical to Express (fdc47dbbc127b75945b54c1af6f8df37e7b4e9fe)
    • Get rid of deprecated url.parse in favor of a custom func (9a5573fb7fd724d52217745c839d81bacb3f90f9)
    • Get rid of mutate function in app.handle (d533d2cbac50d93e6f88b0cc738e90fe1fbb2125)

    New packages

    • the tinyhttp CLI has been created which allows you to easily quick start projects using the repository examples.

    For example:

    tinyhttp new prisma-graphql my-new-project --prettier --eslint
    
    • work on Deno port of tinyhttp has started. It's currently very basic and the more stable version of it is going to be in v2

    Example from README:

    import { App } from 'https://deno.land/x/[email protected]/app.ts'
    
    const app = new App()
    
    app.use('/', (req, next) => {
      console.log(`${req.method} ${req.url}`)
    
      next()
    })
    
    app.get('/:name/', (req) => {
      req.respond({ body: `Hello ${req.params.name}!` })
    })
    
    app.listen(3000, () => console.log(`Started on :3000`))
    

    Wares

    • @tinyhttp/logger: no longer depend on core (01265c002d18a06e210f45bf5cb3a82f4e86d51a)
    • @tinyhttp/cors: support a range of origins and regex (6502fcc56b05d6112c615f2af514dab0aa3ec248)
    • @tinyhttp/cors: preflightContinue setting (c1cd15a21964c021e831d95eb936c7ced224fba8)
    • @tinyhttp/cors: Fix 404 on OPTIONS in (263dd95215136f0717d9016bdf371f7747afb7a3)

    Docs

    • Added a mention of req.range (de0ea5503c7b50907d99598b831bed5d69e6f31e)
    • Show quick start in "Learn" page with the new tinyhttp CLI (0c788d646ff187598f7c4bd5222f1b1b3289400c)
    • Add "Donate" secion in readme (7e81e5ee1de2cc3d8c416995119fa7445c1205dc)

    Examples

    • Rewrite validator example (a83d59926f07d8e90273d0791da47fcb4fdc8915)
    • Update AWS example (8468755650d156a5689a9174ab8113dc808a38be)

    Other

    • Add missing headers for res.sendFile (de0ea5503c7b50907d99598b831bed5d69e6f31e)
    • Fix res.cookie not appending headers (bd5ca65c94c4a3a47ab8d36f58070148425aaf81)
    • Make value argument optional for res.set and res.header (b06d8d5da933b86fd64e4b7afdca5f24cb02f1cb)
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 21, 2020)

    Core

    • Fixes bugs with req.url, req.path and req.originaUrl (#203)
    • Fixes res.redirect incorrect URI encoding (#205)
    • Fixes res.set (and extensions using it) not adding charset
    • Fixes res.render not inheriting template engine settings

    Middleware

    • @tinyhttp/markdown now sends a stream instead of plain text using streamdown
    • @tinyhttp/markdown doesn't have recursive option anymore. Instead of file listing, the current directory is switched in case the path contains a directory. Therefore, the ware no longer depends on readdirp
    • @tinyhttp/markdown now has a caching setting to configure Cache-Control header
    • @tinyhttp/session now uses express-session as direct dependency instead of dev (#201)

    Docs

    • Fix typo with router methods in the docs (#204)
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Nov 24, 2020)

    Finally, after months of hard work, different implementation decisions, collaborations with contributors I'm thrilled to announce the first stable release of tinyhttp!

    Express API implementation

    100% ready. The only method that isn't implemented is app.param, which was deprecated in Express 4.11.

    Core

    Catching errors in async handlers

    errors thrown in async handlers are now catched and passed to next, e.g. if an error is throwed in a handler it won't crash and will keep working.

    Example:

    import { App } from '@tinyhttp/app'
    
    const app = new App()
    
    app.use(async (_req, _res) => {
      throw `error`
    })
    
    app.listen(3000)
    

    The app will return the error and send 500 status:

    $ curl localhost:3000
    error
    

    Custom middleware extensions

    WIth the new applyExtensions parameter you can define your own req / res extensions, or disable all tinyhttp's extensions to achieve the best performance.

    import { App } from '@tinyhttp/app'
    import { send } from '@tinyhttp/send'
    
    const app = new App({
      applyExtensions: (req, res, next) => {
        // now tinyhttp only has a `res.send` extension
        res.send = send(req, res)
      }
    })
    

    Other changes

    • Test coverage is increased to 92%
    • The majority of tinyhttp's modules have more flexible types now which don't require the full implementation of IncomingMessage and ServerResponse objects but only the properties which are used inside the module. This will let developers use these packages inside their own projects and not only in Node.js runtime.
    • Docs are updated with the current status of the project.
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Oct 16, 2020)

    During hacktoberfest, lots of folks helped the project by submitting examples, writing tests and creating new middlewares. Thanks to everyone who contributed to the project!

    Release details

    Express API implementation progress

    ~96% of API is ready. Only a few methods left.

    • res.append
    • req.path

    New middleware

    New examples

    • Prisma REST API
    • Prisma GraphQL
    • PostgreSQL
    • Sapper (Svelte SSR)
    • React SSR
    • rate limiting
    • auth (session)
    • search engine

    Other minor changes

    • Coverage increase from 60% to 71%

    • @tinyhttp/markdown's recursive prop works properly now

    Source code(tar.gz)
    Source code(zip)
  • 0.4(Sep 22, 2020)

    In 0.4.X a lot of new req / res extensions are added, also some new app settings.

    Request / Response extensions

    Request

    Properties

    • req.subdomains
    • req.app

    Methods

    • req.acceptsCharsets
    • req.acceptsEncodings
    • req.acceptsLanguages
    • req.is

    Response

    Properties

    • res.locals
    • res.app

    Methods

    • res.type
    • res.format
    • res.redirect :tada:

    App

    App now has 2 new settings:

    • subdomainOffset - configuration of req.subdomains domain offset
    • bindAppToReqRes - access req.app and res.app

    Packages

    Created new package - @tinyhttp/type-is

    Source code(tar.gz)
    Source code(zip)
  • 0.3(Sep 18, 2020)

    This is the first proper github minor release with lots of fixes and changes, all were made during a few months of hard work. Also, during this period, tinyhttp gained quite a good starting audience, people already start using it and I feel excited for what cool things can be built with tinyhttp!

    Anyways, here's the release notes (I will probably automate it later):

    • add template engine support
    • add sendFile function (most recent addition) and a lot of other Express methods
    • finish writing the docs
    • add "common tasks" and "advanced topics" sections to docs
    • split @tinyhttp/app by 4 separate framework-agnostic packages
    • setup husky and commitlint
    • add 25 examples
    • add 10 middlewares, including @tinyhttp/session, @tinyhttp/ip-filter and more
    Source code(tar.gz)
    Source code(zip)
Owner
v 1 r t l
17 yo nerd / nightwalker
v 1 r t l
Fast and low overhead web framework, for Node.js

An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. How can you efficiently handle the

Fastify 26k Jan 2, 2023
Realtime.js - a fast frontend framework based on Web-Components.

Realtime.js is a fast frontend framework based on Web-Components and Proxies. It has a lot of features to simplify your way of live as a vanillajs developer. The framework is programmed in such a way, that you can edit it yourself if you need additional features.

Kilian Hertel 7 Nov 1, 2022
A Node.js express middleware that implements API versioning for route controllers

express-version-route This npm package provides an ExpressJS middleware to load route controllers based on api versions. Implementing API Versioning i

Liran Tal 87 Nov 15, 2022
:evergreen_tree: Modern Web Application Framework for Node.js.

Trails is a modern, community-driven web application framework for Node.js. It builds on the pedigree of Rails and Grails to accelerate development by

Trails 1.7k Dec 19, 2022
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)

---- Sorry, this project is not maintained anymore. ---- dawson is a serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gate

dawson 717 Dec 30, 2022
Component based MVC web framework for nodejs targeting good code structures & modularity.

Component based MVC web framework for nodejs targeting good code structures & modularity. Why fortjs Based on Fort architecture. MVC Framework and fol

Ujjwal Gupta 47 Sep 27, 2022
Proof of concept for the Quark.js web framework

Quark.js Proof of Concept Proof of concept for the Quark.js web framework. Examples Express.js Implimentation using express.js as a web server: im

Quark.js 3 Feb 18, 2022
The React Framework

Next.js Getting Started Visit https://nextjs.org/learn to get started with Next.js. Documentation Visit https://nextjs.org/docs to view the full docum

Vercel 98.6k Jan 5, 2023
The Intuitive Vue Framework

Build your next Vue.js application with confidence using Nuxt: a framework making web development simple and powerful. Links ?? Documentation: https:/

Nuxt 41.8k Jan 9, 2023
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) ๐Ÿš€

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest is a framework for building efficient,

nestjs 53.2k Dec 31, 2022
Realtime MVC Framework for Node.js

Website Get Started Docs News Submit Issue Sails.js is a web framework that makes it easy to build custom, enterprise-grade Node.js apps. It is design

Balderdash 22.4k Dec 31, 2022
The Simple, Secure Framework Developers Trust

@hapi/hapi The Simple, Secure Framework Developers Trust Build powerful, scalable applications, with minimal overhead and full out-of-the-box function

hapi.js 14.1k Dec 31, 2022
A framework for real-time applications and REST APIs with JavaScript and TypeScript

A framework for real-time applications and REST APIs with JavaScript and TypeScript Feathers is a lightweight web-framework for creating real-time app

Feathers 14.3k Jan 1, 2023
๐Ÿš€ The Node.js Framework highly focused on developer ergonomics, stability and confidence

Sponsored by FOSS United is a non-profit foundation that aims at promoting and strengthening the Free and Open Source Software (FOSS) ecosystem in Ind

AdonisJS Framework 13.4k Dec 31, 2022
:rocket: Progressive microservices framework for Node.js

Moleculer Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services.

MoleculerJS 5.5k Jan 4, 2023
MVC framework making it easy to write realtime, collaborative applications that run in both Node.js and browsers

Derby The Derby MVC framework makes it easy to write realtime, collaborative applications that run in both Node.js and browsers. Derby includes a powe

DerbyJS 4.7k Dec 23, 2022
Node.js framework

Node.js framework Total.js framework is a framework for Node.js platfrom written in pure JavaScript similar to PHP's Laravel or Python's Django or ASP

Total.js 4.2k Jan 2, 2023
๐Ÿ” A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. ๐ŸŒˆ

Midway - ไธ€ไธช้ขๅ‘ๆœชๆฅ็š„ไบ‘็ซฏไธ€ไฝ“ Node.js ๆก†ๆžถ English | ็ฎ€ไฝ“ไธญๆ–‡ ?? ๆฌข่ฟŽ่ง‚็œ‹ Midway Serverless 2.0 ๅ‘ๅธƒไผšๅ›žๆ”พ๏ผš https://www.bilibili.com/video/BV17A411T7Md ใ€ŠMidway Serverless ๅ‘ๅธƒ

Midway.js 6.3k Jan 8, 2023
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.

Functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS. Ecosystem Name Description @marblejs/core F

Marble.js 2.1k Dec 16, 2022