node-decorators

by serhiisol

serhiisol / node-decorators

node-decorators

223 Stars 16 Forks Last release: 3 months ago (express-2.4.0) MIT License 102 Commits 32 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Node Decorators

Project implements decorators for modern tools for NodeJS like ExpressJS, Socket.IO

Installation

npm install @decorators/di --save
npm install @decorators/express --save
npm install @decorators/socket --save

Example of usage

Here's example of usage with Express framework. It uses TypeScript and

@decorators/express
package
import { Response, Params, Controller, Get, attachControllers } from '@decorators/express';
import { Injectable } from '@decorators/di';

@Controller('/') @Injectable() class UsersController {

constructor(userService: UserService) {}

@Get('/users/:id') getData(@Response() res, @Params('id') id: string) { res.send(this.userService.findById(id)); } }

let app: Express = express();

attachControllers(app, [UsersController]);

app.listen(3000);

Documentation

Look at the corresponding package for instructions

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.