devnese
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

Description

A backend framework for lazy people.

Installation

Use the npm package manager to install.

npm install devnese

Usage

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
  }
}

Stay in touch

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i devnese

Weekly Downloads

0

Version

1.0.11

License

MIT

Unpacked Size

36.8 kB

Total Files

31

Last publish

Collaborators

  • devnese