Created
April 5, 2020 20:10
-
-
Save ilyaskarim/7a8e914c1b4b83dec1a372daf9210298 to your computer and use it in GitHub Desktop.
Wertik - Custom Module - Rest API Endpoints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let configuration = { | |
// other configuration | |
modules: [ | |
{ | |
name: "Person", | |
restApi: { | |
endpoints: [ | |
{ | |
path: "/path", | |
methodType: "post", | |
handler: (req, res, restApiSuccessResponse, restApiErrorResponse) => { | |
let isAllRight = true; | |
if (isAllRight) { | |
restApiSuccessResponse({ | |
res: res, | |
message: "String", | |
data: {}, | |
}); | |
} else { | |
restApiErrorResponse({ | |
code: 500, | |
err: e, | |
res: res, | |
data: {}, | |
}); | |
} | |
}, | |
}, | |
], | |
}, | |
}, | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment