-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4949d5
commit 838fb6a
Showing
4 changed files
with
57 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
// Imports the server configuration | ||
var app = require('./server/config'); | ||
|
||
// Sets port to deployed port or local 9000 | ||
/**************** | ||
Server Engine | ||
****************/ | ||
|
||
/* | ||
Runs the configuration and starts up the server | ||
*/ | ||
var app = require('./server/config'); | ||
var port = process.env.PORT || 9000; | ||
|
||
// Starts server on provided port | ||
app.listen(port, function() { | ||
console.log('listening on 9000'); | ||
console.log('listening on', port); | ||
}); |
This file contains 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 |
---|---|---|
@@ -1,37 +1,55 @@ | ||
/* Imports */ | ||
|
||
/**************** | ||
Server Config | ||
****************/ | ||
|
||
/* | ||
Sets up the routing for the server, sending each | ||
API request to its associated controller | ||
*/ | ||
|
||
/* * Imports * */ | ||
|
||
var express = require('express'); | ||
var bodyParser = require('body-parser'); | ||
var morgan = require('morgan'); | ||
|
||
/* Declarations */ | ||
module.exports = app = express(); | ||
var topRouter = express.Router(); | ||
var peopleRouter = express.Router(); | ||
var twitterRouter = express.Router(); | ||
var contextRouter = express.Router(); | ||
var sitesRouter = express.Router(); | ||
/* * Middleware * */ | ||
|
||
/* Configuration */ | ||
module.exports = app = express(); | ||
app.use(bodyParser.json()); | ||
// app.use(morgan('dev')); | ||
app.use(express.static(__dirname + '/../client/dist/public')); | ||
|
||
/* * API Routing * */ | ||
|
||
var topRouter = express.Router(); | ||
app.use('/api/top', topRouter); | ||
require('./router.js').top(topRouter); | ||
|
||
var peopleRouter = express.Router(); | ||
app.use('/api/people', peopleRouter); | ||
require('./router.js').people(peopleRouter); | ||
|
||
var twitterRouter = express.Router(); | ||
app.use('/api/twitter', twitterRouter); | ||
require('./router.js').twitter(twitterRouter); | ||
|
||
var contextRouter = express.Router(); | ||
app.use('/api/context', contextRouter); | ||
require('./router.js').context(contextRouter); | ||
|
||
var sitesRouter = express.Router(); | ||
app.use('/api/sites', sitesRouter); | ||
require('./router.js').sites(sitesRouter); | ||
|
||
/* serves index on default */ | ||
var facebookRouter = express.Router(); | ||
app.use('/api/facebook', facebookRouter); | ||
require('./router.js').facebook(facebookRouter); | ||
|
||
/* | ||
Serves index on default | ||
TODO: Fix this | ||
*/ | ||
app.use(function(req, res) { | ||
res.redirect('/'); | ||
}); |
This file contains 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