-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
78 lines (61 loc) · 2.38 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var express = require('express'),
path = require('path'),
api = require('./api'),
config = require('./config'),
bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: false
}));
app.get('/about', function (req, res) {
res.sendFile(path.join(__dirname + '/views/about.html'));
});
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname + '/views/index.html'));
});
app.get('/search', function (req, res) {
res.sendFile(path.join(__dirname + '/views/index.html'));
});
app.get('/program', function (req, res) {
res.sendFile(path.join(__dirname + '/views/program.html'));
});
app.get('/universities', function (req, res) {
res.sendFile(path.join(__dirname + '/views/universities.html'));
});
app.get('/university', function (req, res) {
res.sendFile(path.join(__dirname + '/views/university.html'));
});
app.get('/search', function (req, res) {
res.sendFile(path.join(__dirname + '/views/search.html'));
});
app.get('/img/custom.css', function (req, res) {
res.sendFile(path.join(__dirname + '/img/custom.css'));
});
app.get('/img/custom.min.css', function (req, res) {
res.sendFile(path.join(__dirname + '/img/custom.min.css'));
});
app.get('/controller.js', function (req, res) {
res.sendFile(path.join(__dirname + '/controller.js'));
});
app.get('/img/logo-sm.png', function (req, res) {
res.sendFile(path.join(__dirname + '/img/logo-sm.png'));
});
app.get('/img/logo-lg.png', function (req, res) {
res.sendFile(path.join(__dirname + '/img/logo-lg.png'));
});
app.get('/listPrograms', api.listPrograms);
app.get('/listUniversities', api.listUniversities);
app.get('/listUniversitiesTypeahead', api.listUniversitiesTypeahead);
app.get('/findProgramById', api.findProgramById);
app.get('/findProgramsByUniversityId', api.findProgramsByUniversityId);
app.post('/searchPrograms/', api.searchPrograms);
app.post('/saveUniversity', api.saveUniversity);
app.post('/saveProgram', api.saveProgram);
app.get('/findUniversityById', api.findUniversityById);
app.get('/findUniversityNameById', api.findUniversityNameById);
app.delete('/deleteProgram/:id', api.deleteProgram);
app.delete('/deleteUniversity/:id', api.deleteUniversity);
app.listen(config.node_port, function () {
console.log('Express server listening on port ' + config.node_port + ', DB is MongoDB');
});