-
Notifications
You must be signed in to change notification settings - Fork 7
/
server.js
35 lines (29 loc) · 1010 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
var express = require('express');
var bodyParser = require('body-parser');
var jobListingRouter = require('./routes/jobListingRouter');
var localResourceRouter = require('./routes/localResourceRouter');
// var mongoose = require('mongoose');
var path = require('path');
var view = path.resolve(__dirname+'/view');
// mongoose.Promise = global.Promise;
// mongoose.connect('mongodb://localhost/excel-job-search-toolkit');
var app = express();
app.use(express.static(view));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.get(function(req, res) {
res.sendFile(view+'/index.html');
});
app.use('/jobs', jobListingRouter);
app.use('/resources', localResourceRouter);
app.use(function (err, req, res, next) {
if(err) {
console.error(err.stack);
// TODO: need an error html page
res.status(500).send('Sorry, there was an error processing your request');
}
});
app.listen(8080, function() {
console.log('running on port 8080')
});