50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
{
|
|
"Return Function Template": {
|
|
"prefix": "returnfunc",
|
|
"body": [
|
|
"return returnFunc({",
|
|
"\tsuccess: ${1:true},",
|
|
"\tlevel: \"${2:error}\",",
|
|
"\tmodule: \"${3:system}\",",
|
|
"\tsubModule: \"${4:db}\",",
|
|
"\tmessage: \"${5:Failed to connect to the prod sql server.}\",",
|
|
"\tdata: ${6:[]},",
|
|
"\tnotify: ${7:false},",
|
|
"\troom: ${8:''},",
|
|
"});"
|
|
],
|
|
"description": "Insert a returnFunc template"
|
|
},
|
|
"Create Log factory Template": {
|
|
"prefix": "createLog",
|
|
"body": [
|
|
"createLogger({",
|
|
"\tmodule: \"${2:system}\",",
|
|
"\tsubModule: \"${2:start up}\",",
|
|
"});"
|
|
]
|
|
},
|
|
"Create Example Route Template":{
|
|
"prefix": "createRoute",
|
|
"body":[
|
|
"import { Router } from \"express\";",
|
|
"\timport { apiReturn } from \"../utils/returnHelper.utils.js\";",
|
|
|
|
"\tconst r = Router();",
|
|
"\tr.post(\"/\", async (req, res) => {",
|
|
"\t",
|
|
"\tapiReturn(res, {",
|
|
"\tsuccess: true,",
|
|
"\tlevel: \"info\", //connect.success ? \"info\" : \"error\",",
|
|
"\tmodule: \"routes\",",
|
|
"\tsubModule: \"auth\",",
|
|
"\tmessage: \"Testing route\",",
|
|
"\tdata: [],",
|
|
"\tstatus: 200, //connect.success ? 200 : 400,",
|
|
"});",
|
|
"});",
|
|
"\texport default r;"
|
|
]
|
|
}
|
|
}
|