diff options
author | Marvin Borner | 2019-02-13 17:14:47 +0100 |
---|---|---|
committer | Marvin Borner | 2019-02-13 17:14:47 +0100 |
commit | 6a967887df29c0051a22df96463aed63b7ece729 (patch) | |
tree | 15b91fccb40990ebc2e0c822b843582e672f0465 /src | |
parent | 8cad9c810741088a1874b58e80245ce83909b582 (diff) |
Code cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/index.js | 28 | ||||
-rw-r--r-- | src/routes.js | 4 | ||||
-rw-r--r-- | src/server.js | 12 |
3 files changed, 23 insertions, 21 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, + }); }); diff --git a/src/routes.js b/src/routes.js index d97ed0a..65ac32d 100644 --- a/src/routes.js +++ b/src/routes.js @@ -5,7 +5,7 @@ * See https://github.com/texxme/Texx/blob/master/LICENSE */ -import {Router} from 'express'; +import { Router } from 'express'; const routes = Router(); @@ -13,7 +13,7 @@ const routes = Router(); * GET home page */ routes.get('/', (req, res) => { - res.render('index'); + res.render('index'); }); export default routes; diff --git a/src/server.js b/src/server.js index d3c0760..61eb331 100644 --- a/src/server.js +++ b/src/server.js @@ -6,13 +6,15 @@ */ /** - * This script should only be used on a deployment server. For debugging purposes please use 'npm run dev' + * This script should only be used on a deployment server. + * For debugging purposes please use 'npm run dev' */ const PeerServer = require('peer').PeerServer; + const server = PeerServer({ - debug: true, - port: 4242, - path: '/api', + debug: true, + port: 4242, + path: '/api', }); -server.on('connection', id => console.log('New connection: ' + id)); +server.on('connection', id => console.log(`New connection: ${id}`)); |