Http Module 📝
The Http tool will help you manage http status, to better manage and organize your request responses.
Note 📦: rocket-kit uses the http-status-codes package
const Http = {
ReasonPhrases,
StatusCodes,
getReasonPhrase,
getStatusCode,
};
// "path file" ~ ./utils/rocketKit
import { createRocket } from "next-rocket-kit";
export const { Http } = createRocket();
// "path file" ~ ./src/app/api/route.ts
import { Http } from "@/utils/rocketKit";
import { Route } from "@/utils/Route";
// End Point GET basic
export const GET = Route({
Handler(req, reply, context) {
return reply.json(
{
message: Http.ReasonPhrases.OK, // "OK"
},
{
status: Http.StatusCodes.OK, // 200
}
);
},
});