Skip to content

Commit 66cd03c

Browse files
author
doga budak
committed
Made some changes to increase the readability
1 parent d293ac8 commit 66cd03c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

server.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { join } from 'path';
2+
import cacheableResponse from 'cacheable-response';
3+
import express from 'express';
4+
import bodyParser from 'body-parser';
5+
16
require('@babel/polyfill');
27

3-
const { join } = require('path');
4-
const cacheableResponse = require('cacheable-response');
5-
const express = require('express');
68
const next = require('next');
7-
89
const port = parseInt(process.env.PORT, 10) || 3000;
910
const dev = process.env.NODE_ENV !== 'production';
1011
const app = next({ dev });
@@ -70,8 +71,8 @@ Promise.all([
7071
});
7172
}
7273

73-
server.post('/value', require('body-parser').json(), (req, res) => {
74-
if (req.body && req.body.value) {
74+
server.post('/value', bodyParser.json(), (req, res) => {
75+
if (req?.body?.value) {
7576
io.emit('data', req.body.value);
7677
}
7778
res.send('');

0 commit comments

Comments
 (0)