Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,37 @@ Course Planner

A webapp for planning which courses to take and which year to take them in.


## .env file and Database

1. Create a *.env* text file in the root directory

Example structure:

DB_SECRET=secret_here
DB_USER=username_here
DB_PASS=password_here

2. Create your own DB

Go to: https://mlab.com

Create a sandbox MongoDB Database.

You should get a URL for the following.

3. Add user for the Database

Add a user with a password.

Then add that user and password to the *.env* file.

4. Set url database in *config/config.dev.js*

url: 'mongodb://' + process.env.DB_USER + ':' + process.env.DB_PASS + '@ds161179.mlab.com:61179/courseplanner'

The last part of the URL

@ds161179.mlab.com:61179/courseplanner

Should be changed to your specific URL
2 changes: 1 addition & 1 deletion config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var ExtractJwt = require('passport-jwt').ExtractJwt;

// load up the user model
var User = require('../app/models/user');
var config = require('../config/config'); // get db config file
var config = require('../config/config.dev.js'); // get db config file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this isn't correct. In our source files we have config.dev.js. Gulp renames this to config.js. The reason for this is we will have multiple config files - for example, we might have config.prod.js. By specifying the environment when running gulp, it will automagically select the right configuration for what we want to use


module.exports = function(passport) {
var opts = {};
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"stream-series": "^0.1.1"
},
"scripts": {
"build": "gulp",
"buildstart": "npm run build && start",
"start": "node dist/server.js -p $PORT",
"postinstall": "gulp && bower install"
},
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//Load environment variables
require('dotenv').load();


// Modules
var config = require(__dirname + '/config/config');
var config = require(__dirname + '/config/config.dev.js');
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
Expand Down