make linter happy

pull/5370/head
Iuri Matias 6 years ago
parent d0df148702
commit 910402e0ed
  1. 18
      remix-simulator/src/server.js

@ -1,10 +1,12 @@
const express = require('express') const express = require('express')
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const app = express() const app = express()
const expressWs = require('express-ws')(app) const expressWs = require('express-ws')
const Provider = require('./provider') const Provider = require('./provider')
const log = require('./utils/logs.js') const log = require('./utils/logs.js')
expressWs(app)
var provider = new Provider() var provider = new Provider()
app.use(bodyParser.urlencoded({extended: true})) app.use(bodyParser.urlencoded({extended: true}))
@ -14,7 +16,7 @@ app.get('/', (req, res) => {
res.send('Welcome to remix-simulator') res.send('Welcome to remix-simulator')
}) })
app.use(function (req, res) { app.use((req, res) => {
provider.sendAsync(req.body, (err, jsonResponse) => { provider.sendAsync(req.body, (err, jsonResponse) => {
if (err) { if (err) {
res.send({error: err}) res.send({error: err})
@ -23,15 +25,15 @@ app.use(function (req, res) {
}) })
}) })
app.ws('/', function(ws, req) { app.ws('/', (ws, req) => {
ws.on('message', function(msg) { ws.on('message', function (msg) {
provider.sendAsync(JSON.parse(msg), (err, jsonResponse) => { provider.sendAsync(JSON.parse(msg), (err, jsonResponse) => {
if (err) { if (err) {
ws.send({error: err}); ws.send({error: err})
} }
ws.send(JSON.stringify(jsonResponse)); ws.send(JSON.stringify(jsonResponse))
})
}) })
}); })
});
app.listen(8545, () => log('Remix Simulator listening on port 8545!')) app.listen(8545, () => log('Remix Simulator listening on port 8545!'))

Loading…
Cancel
Save