-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (21 loc) · 848 Bytes
/
server.js
File metadata and controls
28 lines (21 loc) · 848 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
28
const express = require('express');
const cookieParser = require('cookie-parser');
const routes = require('./routes');
const app = express();
// Allow usage of cookies.
app.use(cookieParser());
// Allow serving static files from the `/public/` directory.
app.use(express.static('./public'));
//console.log(process.env.PROJECT_DOMAIN);
// Allow rendering of files with a template engine.
app.set('views', './views');
app.set('view engine', 'ejs');
// Register the routes.
//routes(app);
app.route('/').get(routes.triageRun); // '/r/:command.(:operators?)/?:input?'
app.route('/s/:cmdId/').get(routes.triageSuggest);
app.route('/commands.json').get(routes.commandDirectoryJson);
// Begin listening for HTTP requests.
const server = app.listen(process.env.PORT, () => {
console.log('Server listening on port %s', server.address().port);
});