koa-statuscode-pikson
v1.0.0
Published
for koa statucode
Downloads
5
Readme
statusCode
statusCode for koa
一个通用的返回值对象
const statusCode = {
success: {
code: 0,
desc: "success"
},
serverError: {
code: -1,
desc: "Internal Server Error"
},
notFound: {
code: 1005,
desc: "not found"
},
noPermission: {
code: 1004,
desc: "you don't have the permission"
},
alreadyExists: {
code: 1006,
desc: 'already exists',
},
lackOfParameters: {
code: 1003,
desc: 'lack of parameters or invaild parameters',
},
};
返回的是Object.assign 拷贝的对象,所以不用担心对象的引用传递问题