Fetching contributors…
Cannot retrieve contributors at this time
111 lines (92 sloc) 3.35 KB


Create a RESTful service with ES7 decorators for your node.js application.

CI Status npm version Coverage Status Code Climate Issue Count Test Coverage Issue Stats


npm install js-restful --save

Make sure you have a shim for es7 reflect. For example core-js or reflect-metadat.

Usage Extend your node js service class with decorators (this is TypeScript with decorators!):

import { GET, POST, PUT, DELETE, Path, PathParam, HeaderParam, QueryParam } from 'js-restful';

class Book {
    name: string;

class BookService {

    allBooks() : Book[]{
       return [];

    createBook(@PathParam('name') name:string, @HeaderParam('token') token:string) :Book {
        return {id:1, name:name};

    updateBook(@PathParam('id') id:number, @PathParam('name') name:string) : Book {
        return {id:id, name:name};

    deleteBook(@PathParam('id') id:number, @QueryParam('time') time:number): boolean {
        return true;

Later (at runtime) you can use the parser to get back all of these information:

import { ServiceDescription, ServiceParser } from 'js-restful';

let serviceDescription = ServiceParser.parse(bookService);

The result is a complete description of your Service:


Ok! But what can I do with this? Have a look at the github project js-restful-express.

This is a base project that different implementations can use to integrate this information in a concrete node js framework.