Last active
May 24, 2019 11:28
-
-
Save ktutnik/5b26000e7803735ff2ead1c8ec309c54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Plumier, { route, WebApiFacility } from "plumier" | |
// controller | |
export class SayController { | |
// GET /say/hello?name=<string>&age=<number> | |
@route.get() | |
hello(name:string, age:number){ | |
return { message: `Hello ${name}, you are ${age} years old!` } | |
} | |
} | |
// application startup | |
new Plumier() | |
.set(new WebApiFacility({ controller: SayController })) | |
.initialize() | |
.then(koa => koa.listen(8000)) | |
.catch(er => console.error(er)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment