Created
May 17, 2016 07:42
-
-
Save pleerock/6ccceaf518b77593f700af37552cf2ad 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 {Request, Response} from "express"; | |
import {JsonController, Get, Post, Put, Patch, Delete} from "routing-controllers"; | |
@JsonController() | |
export class BlogController { | |
@Get("/blogs") | |
getAll() { | |
return [ | |
{ id: 1, name: "Blog 1!" }, | |
{ id: 2, name: "Blog 2!" }, | |
]; | |
} | |
@Get("/blogs/:id") | |
getOne(@Req() request: Request, @Res() response: Response) { | |
return { id: request.param.id, name: "Blog!"}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment