-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
27 lines (24 loc) · 854 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
const express = require('express');
const app = express();
const server = require('http').Server(app);
// initialising peerjs server
const { ExpressPeerServer } = require("peer");
const peerServer = ExpressPeerServer(server, {
debug: true,
});
app.use("/peerjs", peerServer);
// extract style and scripts from sub pages into the layout
const expressLayouts = require('express-ejs-layouts');
app.use(expressLayouts);
app.set('layout extractStyles', true);
app.set('layout extractScripts', true);
// sockets config
const editorSockets = require('./config/editor').editorSockets(server);
// css js images
app.use(express.static('assets'))
const path = require('path');
// following MVC pattern
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use('/', require('./routes'));
server.listen(process.env.PORT || 3000);