@automaton.systems/server
v2.0.0-alpha4
Published
[](https://www.npmjs.com/package/@automaton.systems/server)
Readme
@automaton.systems/server
ZERO compile step combined webserver & API.
A simple combined file and API server for rapid webapp building.
Transparently serves typescript files via transpilation. Just import the .ts file with a .js extension instead!
Usage
npm install "@automaton.systems/server"
Basic Example
import Server from '@automaton.systems/server';
let server = new Server();
server
.serve('/','./public')
.api('api')
.get('item/{id:number}', async (reply, {id})=>{
return await reply.json({id: id});
});
server.start(80);Creates a new server with no authentication on localhost (port 80).
- This server will serve the contents of the local directory
/public/at http://localhost:80/ by default serving index.html at root - HTTP GET Requests to http://localhost:80/api/item/17 will get the json response
{"id": 17}, note the value 17 has been correctly parsed to a number

