Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
7a53dffe
Commit
7a53dffe
authored
Nov 27, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make linter happy
parent
af5b772a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
server.js
remix-simulator/src/server.js
+10
-8
No files found.
remix-simulator/src/server.js
View file @
7a53dffe
const
express
=
require
(
'express'
)
const
bodyParser
=
require
(
'body-parser'
)
const
app
=
express
()
const
expressWs
=
require
(
'express-ws'
)
(
app
)
const
expressWs
=
require
(
'express-ws'
)
const
Provider
=
require
(
'./provider'
)
const
log
=
require
(
'./utils/logs.js'
)
expressWs
(
app
)
var
provider
=
new
Provider
()
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
...
...
@@ -14,7 +16,7 @@ app.get('/', (req, res) => {
res
.
send
(
'Welcome to remix-simulator'
)
})
app
.
use
(
function
(
req
,
res
)
{
app
.
use
(
(
req
,
res
)
=>
{
provider
.
sendAsync
(
req
.
body
,
(
err
,
jsonResponse
)
=>
{
if
(
err
)
{
res
.
send
({
error
:
err
})
...
...
@@ -23,15 +25,15 @@ app.use(function (req, res) {
})
})
app
.
ws
(
'/'
,
function
(
ws
,
req
)
{
ws
.
on
(
'message'
,
function
(
msg
)
{
app
.
ws
(
'/'
,
(
ws
,
req
)
=>
{
ws
.
on
(
'message'
,
function
(
msg
)
{
provider
.
sendAsync
(
JSON
.
parse
(
msg
),
(
err
,
jsonResponse
)
=>
{
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!'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment