Skip to content
example project for docker course
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
server do not try db sync when not intended Apr 12, 2019
.gitignore
README.md
config.js backend for part 2 Nov 10, 2018
index.js
logs.txt Smooth 1.5 mounting Nov 26, 2018
package-lock.json redis improved Mar 25, 2019
package.json

README.md

backend-example-docker

This project is created to help learn docker configurations for backend projects.

Prerequisites

Install node.

Example node install instructions for LTS node 10.x:

curl -sL https://deb.nodesource.com/setup_10.x | bash
sudo apt install -y nodejs

Install all packages with npm install

Starting in production mode

The following are needed from exercise 1.5 onward. Notice, that not everything is necessary for all the exercises.

Exercise 1.11 -> starting project

To start the server in production mode: npm start

Test that the project is running by going to http://localhost:8000

Exercise 1.12 -> accepting connections

If your frontend is not running in the same origin, run the server with FRONT_URL=<front-url> npm start (without < >) to allow cross-origin requests.

Using redis - Part 2 onwards

Use redis by running the server with environment variable REDIS=<hostname>. For example REDIS=localhost. You can also define port with REDIS_PORT=<port-number>, defaults to 6379.

Using database for messages

Use postgres database with environment variables

  • DB_USERNAME=<database user username>
  • DB_PASSWORD=<database user password>
  • DB_NAME=<database-name> defaults to DB_USERNAME if not set.
  • DB_HOST=<hostname> defaults to "localhost" if not set.
You can’t perform that action at this time.