This repository has been archived by the owner on Aug 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
70 lines (51 loc) · 1.76 KB
/
index.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
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var jobDb = require('./db/jobs');
var feedbackDb = require('./db/feedback');
var applicationsDb = require('./db/applications');
var pg = require('pg');
app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json());
// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/', function(request, response) {
// response.render('pages/index');
response.render('pages/job');
});
app.get('/job', function(request, response) {
response.render('pages/job');
});
// app.post('/job/create', function(request, response) {
// console.log(request.body);
// response.render('pages/index');
// });
app.get('/api/job/:id', jobDb.getRecord);
app.get('/api/jobs', jobDb.query);
app.post('/api/jobs', jobDb.createRecord);
app.post('/api/applications', applicationsDb.createRecord);
app.get('/api/applications', applicationsDb.query);
app.post('/api/feedback', feedbackDb.createRecord);
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
/*var cool = require('cool-ascii-faces');
var express = require('express');
var app = express();
app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));
// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/', function(request, response) {
response.render('pages/index')
});
app.get('/cool', function(request, response) {
response.send(cool());
});
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
*/