-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (20 loc) · 803 Bytes
/
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
require('dotenv').config();
const debug = require('debug')('supersonic-lobster:index');
const express = require('express');
const path = require('path');
const index = require('./routes/index');
const ocSsrWrapper = require('./middlewares/oc-ssr');
const app = express();
app.locals.pretty = true;
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.use(require('express-favicon-short-circuit'));
app.use(express.static(path.join(__dirname, '/public')));
app.use(express.static(path.join(__dirname, '/node_modules')));
app.use(ocSsrWrapper({ serverRendering: process.env.OC_REGISTRY_BASE_URL }));
app.use('/', index);
const port = process.env.PORT || 3000;
const server = app.listen(port);
server.on('listening', () => {
debug(`http://127.0.0.1:${port}`);
});