Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaskarim/7a8e914c1b4b83dec1a372daf9210298 to your computer and use it in GitHub Desktop.
Save ilyaskarim/7a8e914c1b4b83dec1a372daf9210298 to your computer and use it in GitHub Desktop.
Wertik - Custom Module - Rest API Endpoints
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