Skip to content

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

Notifications You must be signed in to change notification settings

Odrin/express-easy-rest

Repository files navigation

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published