UNPKG
apibee
Version:
latest (0.0.1)
0.0.1
Make Express routes grouped by some keys.
github.com/bigcoor/ApiBee
bigcoor/ApiBee
apibee
/
lib
/
api_response.js
11 lines
(9 loc)
•
278 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
module.exports.responseMiddleware =
function
responseMiddleware
(
req, res, next
)
{ res.apiSuccess =
function
(
result
)
{ res.
json
({
error
:
null
,
result
: result }); } res.apiError =
function
(
exception
)
{ res.
json
({
error
: exception,
result
:
null
}); }
next
(); };