@peter-schweitzer/ezserver v5.1.2
EZServer
EZServer versions prior to 3.0.3 are no longer available! (version 3.4.3 or newer is recommended)
simple, ultra light weight node.js module with (basically) 0 dependencies for simple backend/REST-API development all implemented in around a thousand lines or less
EZServer is developed on the current node version (v21) but should run on all active LTS versions
Resolving requests
The most basic way of resolving a request is using the 'add' function of the app.
Eg. to resolve a request to /myRequest and respond with Hello World! do the following:
import { App, buildRes, MIME } from '@peter-schweitzer/ezserver';
const app = new App();
app.add('/hello-world', function (_req, res, _params) => {
  buildRes(res, 'Hello, World!', { mime: MIME.TEXT });
});
app.listen(8080);on localhost:8080/hello-world you should see the text "Hello, World!"
The req-Object is passed from the node:http server, but is slightly modified.
EZServer adds the property uri, which is very similar to req.url, but URI-decoded and without a query string.
To provide correct type annotations for the req-Object the EZIncomingMessage type is used.
for further documentation refer to the example
5 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
5 months ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago