UNPKG

mst-scm-server-core

Version:
1 lines 707 B
const e=(e,o,r)=>{if(console.log("mst-scm-server-core origin url:",e.url),o.header("Access-Control-Allow-Origin","*"),o.header("Access-Control-Allow-Headers","Origin, X-Requested-Width, Content-Type, Accept, Authorization, Current-Org-Index"),"OPTIONS"==e.method)return o.header("Access-Control-Allow-Methods","PUT, POST, PATCH, DELETE, GET"),o.status(204).json({});r()},o=(e,o,r)=>{console.log("mst-scm-server-core notFoundHandler");const s=new Error("url not found");s.status=404,r(s)},r=(e,o,r,s)=>{console.log("mst-scm-server-core logging"),console.log(e.stack),r.status(e.statusCode||500).json({success:!1,error:{message:e.message}})};module.exports={generalHandler:e,notFoundHandler:o,errorHandler:r};