blob: 33cfe5f28efebe889631caf0d80569f82e57bb8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import {
type IActivity,
type ITraceable,
JsonResponse,
type PenguenoRequest,
type ServerTrace,
} from "@emprespresso/pengueno";
const messages = [
"D: meow-t found! your api call ran away!",
"404-bidden! but like...in a cute way >:3 !",
":< your data went on a paw-sible vacation!",
"uwu~ not found, but found our hearts instead!",
];
const randomFourOhFour = () =>
messages[Math.floor(Math.random() * messages.length)];
export interface IFourOhFourActivity {
fourOhFour: IActivity;
}
export class FourOhFourActivityImpl implements IFourOhFourActivity {
public fourOhFour(req: ITraceable<PenguenoRequest, ServerTrace>) {
return req
.move(new JsonResponse(req, randomFourOhFour(), { status: 404 }))
.map((resp) => Promise.resolve(resp.get()))
.get();
}
}
|