feat(server): added in service script to run a crud
This commit is contained in:
15
server/globalUtils/apiReturn.ts
Normal file
15
server/globalUtils/apiReturn.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type {Context} from "hono";
|
||||
import type {ContentfulStatusCode} from "hono/utils/http-status";
|
||||
|
||||
export const apiReturn = async (
|
||||
c: Context,
|
||||
success: boolean,
|
||||
message: string,
|
||||
data: any,
|
||||
code: ContentfulStatusCode
|
||||
): Promise<Response> => {
|
||||
/**
|
||||
* This is just a global return function to reduce constacnt typing the same thing lol
|
||||
*/
|
||||
return c.json({success, message, data}, code);
|
||||
};
|
||||
Reference in New Issue
Block a user