node_struct

Basic node app

Usage no npm install needed!

<script type="module">
  import nodeStruct from 'https://cdn.skypack.dev/node_struct';
</script>

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));