Our backend server (Node.js + MongoDB)
You need to set these following environment variables for Github API key, User Agent values, and Slack token:
- GITHUB_API_KEY - Github API key.
- GITHUB_USER_AGENT - your github username.
- SLACK_TOKEN - Slack token.
Then run from your terminal:
git clone [email protected]:dvcoders/dvcoders-backend.git
cd dvcoders-backend
npm install
For development work:
Use nodemon
to have the server restart automatically when changes are made.
npm install -g nodemon
nodemon app.js
For production deployment:
Use pm2
to handle log management and server crashes.
npm install -g pm2
cat <<EOF > server.json
{
"apps": [{
"name": "dvcoders-backend",
"script": "app.js",
"watch": true,
"env": {
"GITHUB_API_KEY": "$GITHUB_API_KEY",
"GITHUB_USER_AGENT": "$GITHUB_USER_AGENT",
"SLACK_TOKEN": "$SLACK_TOKEN"
}
}]
}
EOF
pm2 start server.json
Set up all the required env variables, install development dependencies, and run from your terminal:
mocah test app.js