Skip to content

dhyanitha/api-base

 
 

Repository files navigation

Servidor

Prerequisites

  • Node 7.6 or better.

Note: Node with support for async/await.

Recomended

  • Visual Studio Code

Plugins

Install dependencies

$npm install

Configure

Easy way

Install pm2 and configure ecosystem.json with your configuration

$npm install -g pm2
pm2 start ecosystem.json

pm2 logs --lines 100

Hard Way

Edit enviroment.ts with your configuration, or set all enviroments variables before execute.

$npm run start

Start server

$npm run start

Enviroments

To configure the enviroment just define env as enviroment variable of node and set the value of STAGES emun.

Test

$npm run test

Generate bundle and transpile

$npm run build
$pm2 start ecosystem.json

Why exceptions file

To provide a common errors for HTTP request.

Use ecosystem json provide a better manage of app configuration

{
  "apps" : [
        {
            "name"        : "app-base",
            "script"      : "backend.js",
            "merge_logs"  : true,
            "cwd"         : "absolute path to dist/server",
            "env" : {
               "NODE_ENV": "prod"
            }
        }
  ]
}

About

Base for a great API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 85.2%
  • API Blueprint 9.5%
  • JavaScript 5.3%