Skip to content

Instantly share code, notes, and snippets.

@michaelmiller2116
Created July 5, 2018 21:33
Show Gist options
  • Save michaelmiller2116/086bdf40e12ffd64c8db95a45a0e4444 to your computer and use it in GitHub Desktop.
Save michaelmiller2116/086bdf40e12ffd64c8db95a45a0e4444 to your computer and use it in GitHub Desktop.
Building a MERN stack

What does MERN stand for? MongoDB, Express, React, Node.js Start with backend npm init in empty directory change entry point to server.js in package.json

Install dependencies npm i express body-parser mongoose concurrently npm i -D nodemon

package.json scripts start node server.js server nodemon server.js

Go to mLab.com Create or sign into database if createting DB, create new Select cloud provider choose region name database (unique) submit after summary add database user when done, copy mongoURI and make config in project directory, touch keys.js. and export the key in the file with username and pass

In server.js bring in the keys.js file. ex const db = require('./config/keys').mongoURI

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment