StarterNodeApi
- 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.
The easiest way to get started is to clone the repository:
# Get the latest snapshot with https
git clone https://github.com/jtdarkly/StarterNodeApi.git
# or ssh
git clone git@github.com:jtdarkly/StarterNodeApi.git
# Change directory
cd StarterNodeApi
# Install NPM dependencies
npm install
You will need to create an .env file in the project directory.
NODE_ENV=yourvalue
HOST=yourvalue
PORT=yourvalue
PUBLIC_BASE_URL=yourvalue
DB_HOST=yourvalue
DB_PORT=yourvalue
Within app, defaults are set to:
NODE_ENV=development
HOST=http://localhost
PORT=1337
PUBLIC_BASE_URL=http://localhost:1337
DB_HOST=127.0.0.1
DB_PORT=6379
# Start the API server using node
npm start
# Start in development mode
npm run dev
# Test it*
npm test
# or
npm run test:all
# Just integration test*
npm run test:integration
# Just unit test*
npm run test:unit
# Just system test*
npm run test:system
- When run, NODE_ENV is always set to 'test'.
- Swagger doc can be found in /src/public or URI host/static/swagger.yaml
- Swagger UI can be found at URI host/api-docs