File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change
1
+ import { join } from 'path' ;
2
+ import cacheableResponse from 'cacheable-response' ;
3
+ import express from 'express' ;
4
+ import bodyParser from 'body-parser' ;
5
+
1
6
require ( '@babel/polyfill' ) ;
2
7
3
- const { join } = require ( 'path' ) ;
4
- const cacheableResponse = require ( 'cacheable-response' ) ;
5
- const express = require ( 'express' ) ;
6
8
const next = require ( 'next' ) ;
7
-
8
9
const port = parseInt ( process . env . PORT , 10 ) || 3000 ;
9
10
const dev = process . env . NODE_ENV !== 'production' ;
10
11
const app = next ( { dev } ) ;
@@ -70,8 +71,8 @@ Promise.all([
70
71
} ) ;
71
72
}
72
73
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 ) {
75
76
io . emit ( 'data' , req . body . value ) ;
76
77
}
77
78
res . send ( '' ) ;
You can’t perform that action at this time.
0 commit comments