Skip to content

Instantly share code, notes, and snippets.

@ktutnik
Last active May 24, 2019 11:28
Show Gist options
  • Save ktutnik/5b26000e7803735ff2ead1c8ec309c54 to your computer and use it in GitHub Desktop.
Save ktutnik/5b26000e7803735ff2ead1c8ec309c54 to your computer and use it in GitHub Desktop.
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