项目作者: jlovo256

项目描述 :
Starter Node APi
高级语言: JavaScript
项目地址: git://github.com/jlovo256/StarterNodeApi.git
创建时间: 2018-08-25T21:22:25Z
项目社区:https://github.com/jlovo256/StarterNodeApi

开源协议:

下载


StarterNodeApi

StarterNodeApi

Things to Note

  • You need a .env file. Included in the project is TEMPLATE.env, which has all the variables you need. .gitignore is already set to ignore .env files.

Prerequisites

Installing

The easiest way to get started is to clone the repository:

  1. # Get the latest snapshot with https
  2. git clone https://github.com/jtdarkly/StarterNodeApi.git
  3. # or ssh
  4. git clone git@github.com:jtdarkly/StarterNodeApi.git
  5. # Change directory
  6. cd StarterNodeApi
  7. # Install NPM dependencies
  8. npm install

You will need to create an .env file in the project directory.

  1. NODE_ENV=yourvalue
  2. HOST=yourvalue
  3. PORT=yourvalue
  4. PUBLIC_BASE_URL=yourvalue
  5. DB_HOST=yourvalue
  6. DB_PORT=yourvalue

Within app, defaults are set to:

  1. NODE_ENV=development
  2. HOST=http://localhost
  3. PORT=1337
  4. PUBLIC_BASE_URL=http://localhost:1337
  5. DB_HOST=127.0.0.1
  6. DB_PORT=6379

Usage

  1. # Start the API server using node
  2. npm start
  3. # Start in development mode
  4. npm run dev
  5. # Test it*
  6. npm test
  7. # or
  8. npm run test:all
  9. # Just integration test*
  10. npm run test:integration
  11. # Just unit test*
  12. npm run test:unit
  13. # Just system test*
  14. npm run test:system
  • When run, NODE_ENV is always set to ‘test’.

API Information

  • Swagger doc can be found in /src/public or URI host/static/swagger.yaml
  • Swagger UI can be found at URI host/api-docs

Dependencies