aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/index.js
diff options
context:
space:
mode:
authorMarvin Borner2019-02-13 17:14:47 +0100
committerMarvin Borner2019-02-13 17:14:47 +0100
commit6a967887df29c0051a22df96463aed63b7ece729 (patch)
tree15b91fccb40990ebc2e0c822b843582e672f0465 /src/index.js
parent8cad9c810741088a1874b58e80245ce83909b582 (diff)
Code cleanup
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/index.js b/src/index.js
index f903edd..b27be5d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,7 +5,7 @@
* See https://github.com/texxme/Texx/blob/master/LICENSE
*/
-import {ExpressPeerServer} from "peer";
+import { ExpressPeerServer } from 'peer';
import express from 'express';
import path from 'path';
import logger from 'morgan';
@@ -15,10 +15,10 @@ import routes from './routes';
const app = express();
app.disable('x-powered-by');
-const server = app.listen(8080, "0.0.0.0");
-const peerServer = ExpressPeerServer(server, {debug: true});
+const server = app.listen(8080, '0.0.0.0');
+const peerServer = ExpressPeerServer(server, { debug: true });
-peerServer.on('connection', id => console.log('New connection: ' + id));
+peerServer.on('connection', id => console.log(`New connection: ${id}`));
app.use('/api', peerServer);
@@ -27,10 +27,10 @@ app.set('views', path.join(__dirname, '../views'));
app.set('view engine', 'pug');
app.use(logger('dev', {
- skip: () => app.get('env') === 'test'
+ skip: () => app.get('env') === 'test',
}));
app.use(bodyParser.json());
-app.use(bodyParser.urlencoded({extended: false}));
+app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, '../dist')));
// Routes
@@ -38,16 +38,16 @@ app.use('/', routes);
// Catch 404 and forward to error handler
app.use((req, res, next) => {
- const err = new Error('Not Found');
- err.status = 404;
- next(err);
+ const err = new Error('Not Found');
+ err.status = 404;
+ next(err);
});
// Error handler
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
- res
- .status(err.status || 500)
- .render('error', {
- message: err.message
- });
+ res
+ .status(err.status || 500)
+ .render('error', {
+ message: err.message,
+ });
});