Skip to content

Commit

Permalink
update sample code using new http
Browse files Browse the repository at this point in the history
  • Loading branch information
charleston10 committed Dec 4, 2023
1 parent 8e610e3 commit 970e18b
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions sample/standalone.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
const Mockenzo = require("../index")

const mockJsonFile = require('./mocks/list.json')

const httpMockenzo = Mockenzo()
.http()//init config http
.on(3000)//listen on port
.post('/enzo')//init config route
.delay(3000)//add delay for response
.statusCode(400)//send status code
.response({
'error_code': 400,
'error_description': 'Bad Request'
})
.run()//finish config and run
.get('/enzo')//init new route
.statusCode(401)
.response({
'error_code': 401,
'error_description': 'Unauthorized'
})
.run()
.get('/enzos')
.statusCode(200)
.responseJsonFile(mockJsonFile)
.run()
.start(() => {
console.log("http server is running")
});

Mockenzo().http()
.on(3000)
.run([{
Expand All @@ -49,7 +21,7 @@ Mockenzo().http()

const socketMockenzo = Mockenzo()
.socket()
.on('/', 3001)
.on(3001)
.onConnection(() => {
console.log('received new connection')
})
Expand All @@ -66,5 +38,3 @@ const socketMockenzo = Mockenzo()
.start(() => {
console.log("socket server is running")
})

httpMockenzo.on(3000).create()

0 comments on commit 970e18b

Please sign in to comment.