UNPKG

501 BTypeScriptView Raw
1declare var require: any;
2
3export const withServiceAccess = (complementedCallback: (callService, cbreq, cbres, cbnext) => any) => {
4
5 // we return an array of valid middleware-callbacks
6 return [
7 async function (req, res, next) {
8 return await complementedCallback(req.callService, req, res, next)
9 }
10 ]
11};
12
13
14export const serviceAttachService = (callService) => {
15 return (req, res, next) => {
16
17 req.callService = callService;
18 next();
19 };
20}
21
22
23
24