This repository was archived by the owner on Aug 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Added mongodb database #3
Open
ckucera3
wants to merge
9
commits into
GatechVIP:master
Choose a base branch
from
ckucera3:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1affd21
added configuration for openshift hosting
claytonkucera 623032f
changed port number for openshift
claytonkucera ac29ea5
more configuration for openshift hosting
claytonkucera 481546d
updated readme with new port number
claytonkucera 96cea3f
removed the trailing characters each entry of courses.json
claytonkucera b241e5e
mongo database configuration
claytonkucera 73ff2cb
added routes that query the database
claytonkucera 1c14603
added database specific info to the readme
claytonkucera 1805f04
corrected error in readme
claytonkucera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,20 +2,30 @@ | |
| var express = require('express'); | ||
| var path = require('path'); | ||
| var bodyParser = require('body-parser'); | ||
| var assert = require('assert'); | ||
| var monk = require('monk'); | ||
| var server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080 | ||
| var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1' | ||
| var app = module.exports = express(); | ||
|
|
||
|
|
||
| var routes = require('./routes/index'); | ||
| var port = process.env.PORT || '3000'; | ||
|
|
||
| var app = express(); | ||
| // middleware setup | ||
|
|
||
| // view setup | ||
| //other middleware setup | ||
| // set up mongodb | ||
| var uri = "mongodb://test:[email protected]:45464/courses-backend"; | ||
| var db = monk(uri); | ||
| app.db = db; | ||
| //console.log(courses); | ||
|
|
||
| // other middleware | ||
| app.use(bodyParser.json()); | ||
| app.use(bodyParser.urlencoded({ extended: false })); | ||
| app.use(express.static(path.join(__dirname, 'public'))); | ||
| app.use(express.static(path.join(__dirname + '/views'))); | ||
|
|
||
| //route setup | ||
| var routes = require('./routes/index'); | ||
| app.use('/', routes); | ||
|
|
||
| // error handler | ||
|
|
@@ -24,10 +34,9 @@ app.use(function(err, req, res, next) { | |
| res.send(err); | ||
| }); | ||
|
|
||
| app.listen(port, function(success, failure) { | ||
| console.log('server is running on port ' + port); | ||
| }).on('error', function(err) { | ||
| console.log(err) | ||
| //start the server | ||
| app.listen(server_port, server_ip_address, function(){ | ||
| console.log("Listening on server_port " + server_port) | ||
| }); | ||
|
|
||
| module.exports = app; | ||
| //module.exports = app; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be done as configuration either as an env variable or in a file that isn't committed. Note that there are bots that watch github for this kind of thing in order to hijack accounts.