node_struct
v0.0.4
Published
Basic node app
Downloads
3
Readme
Basic Example
const { Application } = require('node_struct');
const app = new Application();
app.route('/msg/', [middleware], hello_world);
app.serve({ port:8080 });
function middleware({ req }) {
console.log(`Incoming ${req.method}: ${req.url}`)
}
// GoTo : http://localhost:8080/msg/hello/world
function hello_world({ res }) {
res.write('Hello, World!');
res.end();
}
console.log(Object.keys(app.staticRouter));