Closed AsFal closed 4 years ago
Current:
import { Request, Response } from "express"; const newController = { index: async (req: Request, res: Response) => { try { res.status(500).send({ msg: "Not Implemented" }); } catch (err) { res.status(500).send(err); } }, } export { newController };
Proposal
import { Request, Response } from "express"; import * as http from "http-status-codes"; const newController = { index: async (req: Request, res: Response) => { try { res.status(http.INTERNAL_SERVER_ERROR).send({ msg: "Not Implemented" }); } catch (err) { res.status(http.INTERNAL_SERVER_ERROR).send(err); } }, } export { newController }; ## Notes This would add the http-status-codes npm package as a dependency.
We can add our own status codes file in the util directory. This makes it so that users can edit/add to the status codes whenever they want to
Proposal
Current:
Proposal