inital commit
This commit is contained in:
10
packages/server/src/messages/badRequest.ts
Normal file
10
packages/server/src/messages/badRequest.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { baseMessage } from "./baseMessage";
|
||||
|
||||
/**
|
||||
* Creates a response for a bad request
|
||||
*
|
||||
* @returns the bad request message
|
||||
*/
|
||||
export function badRequest(message: string) {
|
||||
return baseMessage(true, message);
|
||||
}
|
13
packages/server/src/messages/baseMessage.ts
Normal file
13
packages/server/src/messages/baseMessage.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Creates a base message for use in JSON responses
|
||||
*
|
||||
* @param error the error status
|
||||
* @param message the message to show
|
||||
* @returns the base message
|
||||
*/
|
||||
export function baseMessage(error: boolean, message: string) {
|
||||
return {
|
||||
error: error,
|
||||
message: message,
|
||||
};
|
||||
}
|
10
packages/server/src/messages/unknownRoute.ts
Normal file
10
packages/server/src/messages/unknownRoute.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { baseMessage } from "./baseMessage";
|
||||
|
||||
/**
|
||||
* Creates a response for an unknown route
|
||||
*
|
||||
* @returns the unknown route message
|
||||
*/
|
||||
export function unknownRoute() {
|
||||
return baseMessage(true, "Unknown route");
|
||||
}
|
Reference in New Issue
Block a user