Multiple implementations of the same back-end application. The aim is to provide quick, side-by-side comparisons of different technologies (languages, frameworks, libraries) while preserving consistent business logic across all implementations.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
721 B

export interface JSendSuccess<T = any> {
status: 'success';
data: T;
}
export interface JSendError {
status: 'error';
message: string;
code?: number;
data?: any;
}
export interface JSendFail {
status: 'fail';
data: any;
}
export type JSendResponse<T = any> = JSendSuccess<T> | JSendError | JSendFail;
export class JSendResponseUtil {
static success<T>(data: T): JSendSuccess<T> {
return {
status: 'success',
data,
};
}
static error(message: string, code?: number, data?: any): JSendError {
return {
status: 'error',
message,
code,
data,
};
}
static fail(data: any): JSendFail {
return {
status: 'fail',
data,
};
}
}