diff options
author | Elizabeth Hunt <me@liz.coffee> | 2025-07-27 17:03:10 -0700 |
---|---|---|
committer | Elizabeth Hunt <me@liz.coffee> | 2025-07-27 18:30:30 -0700 |
commit | 9970036d203ba2d0a46b35ba6fad21d49441cdd4 (patch) | |
tree | a585d13933bf4149dcb07e28526063d071453105 /lib/server/activity/fourohfour.ts | |
download | pengueno-9970036d203ba2d0a46b35ba6fad21d49441cdd4.tar.gz pengueno-9970036d203ba2d0a46b35ba6fad21d49441cdd4.zip |
hai
Diffstat (limited to 'lib/server/activity/fourohfour.ts')
-rw-r--r-- | lib/server/activity/fourohfour.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/server/activity/fourohfour.ts b/lib/server/activity/fourohfour.ts new file mode 100644 index 0000000..cd90ba0 --- /dev/null +++ b/lib/server/activity/fourohfour.ts @@ -0,0 +1,28 @@ +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(); + } +} |