1.0.4 • Published 4 years ago
awebserver v1.0.4
A WEB SERVER
A simple javascript based web server that works with OLD versions of node (v0.6.14)
A hello world example
This is a simple example that demonstrates dynamic url path parameters (People like that stuff)
const server = require('awebserver');
server.addRoute('/hello/{name}', 'GET', function (req, res) {
const name = req.query.name;
console.log(name + " says hello");
res.response(200, "hello " + name + "\n");
});
server.serve(8080);
Commands
This library exposes three basic functions.
addRoute
server.addRoute({PATH}, {METHOD}, {HANDLER FUNCTION});
addErrorHandler
server.addErrorHandler({CODE}, {HANDLER FUNCTION});
serve
server.serve({PORT}, {HTTPS OPTIONS});