πŸ¦„ 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

πŸ“–

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

Sponsors πŸ’°


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 type-safe full stack framework, for TypeScript

Fast and type-safe full stack framework, for TypeScript Why frourio ? Even if you write both the frontend and backend in TypeScript, you can't statica

frourio 1.1k Dec 26, 2022
A simple boilerplate generator for your node express backend project! πŸš€

A simple boilerplate generator for your node express backend project! ??

Gunvant Sarpate 35 Sep 26, 2022
Elegant and all-inclusive Node.Js web framework based on TypeScript. :rocket:.

https://foalts.org What is Foal? Foal (or FoalTS) is a Node.JS framework for creating web applications. It provides a set of ready-to-use components s

FoalTS 1.7k Jan 4, 2023
wolkenkit is an open-source CQRS and event-sourcing framework based on Node.js, and it supports JavaScript and TypeScript.

wolkenkit wolkenkit is a CQRS and event-sourcing framework based on Node.js. It empowers you to build and run scalable distributed web and cloud servi

the native web 1.1k Dec 26, 2022
Full stack CQRS, DDD, Event Sourcing framework for Node.js

reSolve is a full stack functional JavaScript framework. CQRS - independent Command and Query sides. DDD Aggregate support. Event sourcing - using eve

ReImagined 709 Dec 27, 2022
DDD/Clean Architecture inspired boilerplate for Node web APIs

Node API boilerplate An opinionated boilerplate for Node web APIs focused on separation of concerns and scalability. Features Multilayer folder struct

Talysson de Oliveira Cassiano 3k Dec 30, 2022
πŸ¦„ 0-legacy, tiny & fast web framework as a replacement of Express

tinyhttp ⚑ Tiny web framework as a replacement of Express ?? tinyhttp now has a Deno port (work in progress) tinyhttp is a modern Express-like web fra

v 1 r t l 2.4k Jan 3, 2023
Nodeparse - A lightweight, vanilla replacement for Express framework when parsing the HTTP body's data or parsing the URL parameters and queries with NodeJS.

nodeparse A lightweight, vanilla replacement for Express framework when parsing the HTTP body's data or parsing the URL parameters and queries with No

TrαΊ§n Quang Kha 1 Jan 8, 2022
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

curl (cujoJS resource loader) All development for curl.js and cram.js has stopped. For the foreseeable future, we will continue to respond to issues o

The Javascript Architectural Toolkit 1.9k Dec 30, 2022
"shuffle-text" is JavaScript text effect library such as cool legacy of Flash.

ShuffleText This is the JavaScript library for text effect such as Flash contents. Setup Script Install <script src="shuffle-text.js"></script> NPM In

Yasunobu Ikeda 96 Dec 24, 2022
An non-official esx-legacy 1.5 version for quasar inventory purpose.

Hi there ! It's my first post on github, and I'm releasing a free edited base with esx-legacy 1.5 compatible and made for Quasar Inventory. How can I

ChernyyOrel 3 Mar 19, 2022
Several custom made and legacy icons, and icons collected all over the internet in 1 set, UI selectable.

Custom icon library Several custom made and legacy icons, and icons collected all over the internet in 1 set, UI selectable. Upon each Material Design

Marius 12 Dec 12, 2022
In-browser code editor (version 5, legacy)

CodeMirror CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with over 10

CodeMirror 25.6k Jan 5, 2023
This script is the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer.

The HTML5 Shiv The HTML5 Shiv enables use of HTML5 sectioning elements in legacy Internet Explorer and provides basic HTML5 styling for Internet Explo

Alexander Farkas 9.9k Jan 2, 2023
radiQL, your one-stop-shop for migrating from a legacy REST backend to an efficient and modern GraphQL API

Welcome to radiQL, the one-stop solution for setting up GraphQL on a PostgreSQL database. Check out our Medium article here. At A Glance: Give us your

OSLabs Beta 90 Nov 14, 2022
A faster alternative to legacy node:querystring module

fast-querystring Fast query-string parser and stringifier to replace the legacy node:querystring module. Installation npm i fast-querystring Features

Yagiz Nizipli 95 Dec 17, 2022
Make your Vite projects work in IE11 and other legacy browsers.

vite-plugin-legacy-dev Maybe your Vite project needs work on IE11 or other not support ESM legacy browsers, this plugin can help you! This is only for

haiya6 3 Sep 26, 2022
Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.

Select2 Select2 is a jQuery-based replacement for select boxes. It supports searching, remote data sets, and pagination of results. To get started, ch

Select2 25.5k Jan 1, 2023
A beautiful replacement for JavaScript's "alert"

A beautiful replacement for JavaScript's "alert" Installation $ npm install --save sweetalert Usage import swal from 'sweetalert'; swal("Hello world!

Tristan Edwards 22.2k Dec 31, 2022