Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

express-easy-rest

1.1.1 • Public • Published

npm version Build Status

express-easy-rest

Simple and easy, express based, charged with power of TypeScript, REST API framework.

class App extends ApplicationInstance {
  
}
 
export = new App();
@Controller({basePath: '/book'})
export class BookController extends ApiController {
  private books: Book[] = [...];
 
  @Get('/list')
  getBooks(): Promise<Book[]> {
    return new Promise((resolve: any) => {
      setTimeout(() => resolve(this.books), 3000); // here your async db call or anything else
    });
  }
}
var express = require('express');
var app = require('./app');
 
express()
  .use('/api', app.middleware())
  .listen(8000);

Simple things should be simple, complex things should be possible | Alan Kay

Installation

npm install express-easy-rest

Simple tsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./lib",
    "noImplicitAny": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Examples

You can find more examples here.

Features

  • Controller based structure
  • Fast and easy decorators syntax
  • Scalable and customizable architecture
  • Model validation

Any coincidence with asp.net WebAPI platform are accidental... or not.

Why TypeScript?

TypeScript helps you to create a well-structured, scalable and neat applications with the ability to use the most modern technologies. Magic of decorators makes your code more flexible and clean, and allows you to pay more attention to what you want to do, rather than how to do it.

install

npm i express-easy-rest

Downloadsweekly downloads

0

version

1.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability