Skip to content

npm module for fast backend/REST-API development with no (exactly 0!) dependencies, inspired by the express framework

License

Notifications You must be signed in to change notification settings

jeremyssocial/EZServer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

npm module for fast backend/REST-API development with no (exactly 0!) dependencies, inspired by the express framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.3%
  • Other 0.7%