Détail du package

srvx

h3js11.1kMIT0.7.3

Universal Server API based on web platform standards. Works seamlessly with Deno, Bun and Node.js.

readme

💥 srvx

npm version npm downloads

Universal Server API based on web platform standards. Works with Deno, Bun and Node.js.

Quick start

import { serve } from "srvx";

const server = serve({
  port: 3000,
  fetch(request) {
    return new Response("👋 Hello there!");
  },
});

👉 Visit the 📖 Documentation to learn more.

Development

<summary>local development</summary> - Clone this repository - Install the latest LTS version of Node.js - Enable Corepack using corepack enable - Install dependencies using pnpm install - Run interactive tests using pnpm dev

License

Published under the MIT license. Made by @pi0 and community 💛


🤖 auto updated with automd

changelog

Changelog

v0.7.3

compare changes

🩹 Fixes

  • node: Only use req.headers in FastResponse when initialized (#79)

💅 Refactors

  • Include invalid header name in error message (d0bf7dc)

🏡 Chore

  • Add --watch to playground scripts (222580e)
  • Add erasableSyntaxOnly option to compiler options (#77)
  • Update undocs (5d263b1)
  • Build docs native dep (7c8b337)

❤️ Contributors

v0.7.2

compare changes

🚀 Enhancements

  • node: Call request abort signal (#76)

🩹 Fixes

📖 Documentation

  • guide/plugins: Make middleware functions asynchronous (#70)
  • guide/bundler: Improve bundle usage explanation (#73)

📦 Build

🏡 Chore

❤️ Contributors

v0.7.1

compare changes

📦 Build

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.7.0

compare changes

🚀 Enhancements

  • node: Support http2 (#58)
  • ⚠️ Top level middleware and simplified plugins (#67)
  • Clone options and init middleware: [] (16798c1)

🩹 Fixes

  • Add missing types for node.upgrade (7f66ac3)
  • url: Always invalidate cached values (059914d)

💅 Refactors

  • ⚠️ Remove experimental upgrade (#68)
  • ⚠️ Use process.getBuiltinModule for node (#69)
  • Move node compat to adapters/_node (e594009)

📦 Build

🏡 Chore

✅ Tests

  • Add wpt setter tests for FastURL (#66)
  • Add more coverage for FastURL (7e8ebd2)

⚠️ Breaking Changes

  • ⚠️ Top level middleware and simplified plugins (#67)
  • ⚠️ Remove experimental upgrade (#68)
  • ⚠️ Use process.getBuiltinModule for node (#69)

❤️ Contributors

v0.6.0

compare changes

🚀 Enhancements

  • ⚠️ Fetch middleware via plugins (#62)
  • Support upgrade hook (experimental) (#63)

🩹 Fixes

  • node: Handle additional response headers (#64)

💅 Refactors

  • ⚠️ Rename onError hook to error for consistency (471fe57)
  • ⚠️ Rename to FastURL and FastResponse exports (0fe9ed4)

🏡 Chore

⚠️ Breaking Changes

  • ⚠️ Fetch middleware via plugins (#62)
  • ⚠️ Rename onError hook to error for consistency (471fe57)
  • ⚠️ Rename to FastURL and FastResponse exports (0fe9ed4)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.5.2

compare changes

🚀 Enhancements

  • Fast URL for node, deno and bun (b5f5239)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.5.1

compare changes

🩹 Fixes

  • service-worker: Minor fixes (63a42b5)

🏡 Chore

  • Apply automated updates (248d0b5)
  • Update playground sw example to use cdn (b333bd4)
  • Fix node compat internal types (7862ab0)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.5.0

compare changes

🚀 Enhancements

  • Experimental service-worker adapter (#53)
  • service-worker: Self-register support (#55)
  • Generic adapter (#56)
  • ⚠️ Print listening url by default (#57)
  • Support HOST env for node, deno and bun (2d94e28)
  • Add runtime agnostic error handler (#48)

💅 Refactors

🏡 Chore

⚠️ Breaking Changes

  • ⚠️ Print listening url by default (#57)

❤️ Contributors

v0.4.0

compare changes

💅 Refactors

  • ⚠️ Use request.ip and request.runtime (#51)

🏡 Chore

  • Apply automated updates (59e28fa)

⚠️ Breaking Changes

  • ⚠️ Use request.ip and request.runtime (#51)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.3.0

compare changes

💅 Refactors

  • ⚠️ Move extended request context under request.x.* (#50)

📖 Documentation

  • Improve quick start (#49)

🏡 Chore

  • Update editorconfig to include typescript files (#47)

⚠️ Breaking Changes

  • ⚠️ Move extended request context under request.x.* (#50)

❤️ Contributors

v0.2.8

compare changes

🚀 Enhancements

  • node: Expose internal proxy classes (0cdfa22)
  • node: Support Response static methods (b9976a4)

🩹 Fixes

  • node: Use null for unset headers (#45)

💅 Refactors

  • Remove unused symbols (c726e40)
  • Accept node ctx for NodeResponseHeaders constructor (8fe9241)

📦 Build

  • Add types condition to top (82e7fcc)

🏡 Chore

  • Update node tests (#42)

❤️ Contributors

v0.2.7

compare changes

🚀 Enhancements

  • node: Expose node context to proxy interfaces (5f20d9e)

🩹 Fixes

  • node: Make sure response constructor name is Response (782ee13)
  • node: Make sure all proxies mimic global name and instance (5883995)
  • node: Use global Response for cloing (effa940)
  • node: Avoid conflict with undici prototype (40cacf2)

💅 Refactors

  • types: Fix typo for BunFetchHandler (#41)

📦 Build

❤️ Contributors

v0.2.6

compare changes

🚀 Enhancements

  • Support tls and protocol (#38)

🔥 Performance

  • adapters/node: Check req._hasBody once (978a27d)

🩹 Fixes

  • node: Flatten headers to handle node slow path (#40)

🏡 Chore

❤️ Contributors

v0.2.5

compare changes

🩹 Fixes

  • Fix Response type export (e8d25e9)
  • node: Set Response prototype for NodeFastResponse (2e6a8a0)

🏡 Chore

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.2.4

compare changes

🩹 Fixes

  • Fix Response type export (e8d25e9)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.2.3

compare changes

🩹 Fixes

  • node: Use headers.entries when full Headers is set as init (7f8cac8)
  • node: Make req instanceof Request working (24b3f83)

📦 Build

  • Fix types export (#36)
  • Add types export for . (#37)

🏡 Chore

❤️ Contributors

v0.2.2

compare changes

🚀 Enhancements

  • node: Support node readable stream (bc72436)

🩹 Fixes

  • node: Don't send headers if already sent (bbf6b86)
  • Add Response export type (e63919b)
  • node: Use headers.entries when full Headers is set as init (7f8cac8)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.2.1

compare changes

🚀 Enhancements

🏡 Chore

  • Apply automated updates (5a1caf0)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.2.0

compare changes

🚀 Enhancements

💅 Refactors

  • ⚠️ Update exports (7153090)
  • ⚠️ Overhaul internal implementation (d444c74)

📦 Build

🏡 Chore

✅ Tests

🤖 CI

⚠️ Breaking Changes

  • ⚠️ Update exports (7153090)
  • ⚠️ Overhaul internal implementation (d444c74)

❤️ Contributors

  • Pooya Parsa (@pi0)

v0.1.4

compare changes

🩹 Fixes

  • node: Access req headers with lowerCase (#21)

💅 Refactors

  • node: Improve body streaming (#26)

🏡 Chore

❤️ Contributors

v0.1.3

compare changes

🚀 Enhancements

  • node: Add NodeFastResponse.bytes() (#16)
  • node: Add NodeRequestProxy.bytes() (07863f6)

🩹 Fixes

  • node: Compute hasBody when accessing req.body (a002185)
  • node: Body utils should respect buffer view offset (5e4ec69)

💅 Refactors

  • node: Expose request._url (8eb8f5d)

📖 Documentation

  • Minor tweaks (#9)

🏡 Chore

✅ Tests

  • Update ip regex (6885842)
  • Add additional tests for req body handling (e00b4c9)

❤️ Contributors

v0.1.2

compare changes

🚀 Enhancements

  • node: Add NodeFastResponse.bytes() (#16)
  • node: Add NodeRequestProxy.bytes() (07863f6)

📖 Documentation

  • Minor tweaks (#9)

🏡 Chore

❤️ Contributors

v0.1.1

🚀 Enhancements

🩹 Fixes

  • node: Send body with NodeFastResponse (ac689ef)

💅 Refactors

📖 Documentation

  • Remove extra await (#2)
  • Update diff explainer (fbd81af)

🏡 Chore

🤖 CI

❤️ Contributors