Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.08 KB

README.md

File metadata and controls

30 lines (19 loc) · 1.08 KB

EZServer

EZServer versions prior to 2.0.0 are very deprecated and not 'stable' or 'production-ready'

simple, ultra light weight node.js module with 0 dependencies for simple backend/REST-API development

EZServer is developed on the current node version (v19) but should run on all active LTS versions

Resolving requests

The most basic way of resolving a request is usíng the 'add' function of the app. Eg. to resolve a request to /myrequest and respond with Hello World! do the following:

const { App, buildRes } = require('@peter-schweitzer/ezserver');

const app = new App();

app.add('/myrequest', (req, res) => {
  buildRes(res, 'Hello World!');
});

app.listen(8080);

The req-Object is passed from the node:http server, but is slightly modified.
EZServer addsreq.uri, which is very similar to req.url, but URI-decoded and without a query string.

for further documentation & examples refer to example/index.js