-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.js
More file actions
27 lines (21 loc) · 757 Bytes
/
app.js
File metadata and controls
27 lines (21 loc) · 757 Bytes
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
var express = require('express');
var app = express();
// require('./auth/init')(app); // uncomment for login (mongodb dependency)
app.get('/constitution', function (req, res) {
res.sendfile('public/constitution/index.html');
});
app.post('/interest', function (req, res) {
var str = 'name: ' + req.body.name + ' email: ' + req.body.email + ' year: ' + req.body.year + '\n';
require('fs').appendFile('data/interest.txt',str, function(err){
res.send('Thanks!');
});
});
app.get('/:section', serveIndex);
app.get('/', serveIndex);
function serveIndex (req,res) {
res.sendfile('public/index.html');
}
app.use(express.static(__dirname+'/public'));
app.listen(3000,function(){
console.log('KTP web server listening on port 3000!');
});