A backend framework for lazy people.
Use the npm package manager to install.
npm install devnese
index.ts
import { App, Swagger } from 'devnese';
import { UserRoute } from './user.route';
const port = (process.env.PORT || 3000) as number
const app = new App();
app.contain([
UserRoute
])
Swagger.init(app);
app.listen(port);
user.route.ts
import { Route, Get, Post, Put, Delete, Req, Res, BadRequestError } from "devnese";
@Route('user')
export class UserRoute {
@Get('/')
index(req: Req, res: Res) {
res.send('Hello world!')
}
@Get('/error')
error(req: Req, res: Res) {
throw new BadRequestError();
}
@Post('/')
create() {
//TODO: method create
}
@Put('/:id')
edit() {
//TODO: method put
}
@Delete('/')
delete() {
//TODO: method delete
}
}
- Author - Thanh Vu