@ogginger/server
v1.0.7
Published
A quick setup api server.
Downloads
3
Readme
Server
- Create a route member that has type any and is assigned to a function that returns an object that contains the routes and their corresponding methods.
class myServer extends Server {
public state: any = function() {
return {
"get": {
"/": function( request: any, response: any ) {
response.send("Hello World!");
}
}
};
}
}
- Instantiate the server with the port you want it to listen on.
let server = new myServer(8000);
- Call the asynchronous initialize method to setup the server after instantiating it.
await server.initialize();