This project is a simplistic start for working with Node, Mongo and Express with CI using TravisCI and dependency Security with Snyk.
TODO: Add more discussion
- clone this repo
cd node-mongo-express
- Install all the node modules:
npm install
- Start up an instance of mongodb. The easiest way (if you have docker installed) is to use docker
docker run --rm -d --name mongo-serv mongo
this will startup mondb on its default port27017
- Create the database for the app:
npm run makedb
- Run the server:
npm run dev
TODO: Add more discussion
If you haven't installed Node
on your development machine, you can still develop using Docker
. In this example
you'll create a network for your containers to connect to, then run Mongo
using a docker daemon and an interactive
node
shell container on your current directory to do your development.
- Create a docker network for node to talk to mongo
$ docker create network mongo-net
- Run an insecure mondodb instance that will dissappear on a kill
$ docker run --rm -d --name mongo-serv --network mongo-net mongo
- Run the node development container
$ docker run --rm -ti -v $PWD:/app -w /app --network mongo-net -p 3000:3000 node:slim /bin/bash
- Follow the steps above at TL;DR (replacing the mongodb startup with the one described in this section)
TODO: Add more discussion
Update the github account and repository to display your TravisCI badge:
[![Build Status](https://travis-ci.org/{your-github-account}/{your-project-name}.svg?branch=master)](https://travis-ci.org/{your-github-account}/{your-project-name})
TODO: Add more discussion
Update the github account and repository to display your Snyk badge:
[![Known Vulnerabilities](https://snyk.io/test/github/{your-github-account}/{your-project-name}.svg)](https://snyk.io/test/github/{your-github-account}/{your-project-name})