-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
31 lines (25 loc) · 919 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
var express = require('express'),
companies = require('./routes/companies'),
filings = require('./routes/filings'),
files = require('./routes/files');
var app = express();
app.configure(function () {
app.use(express.logger('dev'));
app.use(express.bodyParser());
});
// Static web pages
app.get('/', files.serveIndex);
// REST operations for companies
app.get('/v0/companies', companies.findAll);
app.get('/v0/companies/:cik', companies.findByCIK);
app.post('/v0/companies', companies.addCompany);
app.put('/v0/companies/:cik', companies.updateCompany);
app.delete('/v0/companies/:cik', companies.deleteCompany);
// REST operations for filings
app.get('/v0/filings', filings.findAll);
app.get('/v0/filings/:acc_num', filings.findByAccNum);
console.log("Environment: " + process.env.NODE_ENV);
var port = process.env.PORT || 3000;
app.listen(port, function() {
console.log("Listening on " + port);
});