From 6f40b2db306dc0f58d6a465fd60ccf385c3a932e Mon Sep 17 00:00:00 2001 From: Paolo Brasolin <paolo.brasolin@eurac.edu> Date: Tue, 22 Feb 2022 19:23:10 +0100 Subject: [PATCH] feat: mock /GetImage --- backend/src/index.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/backend/src/index.ts b/backend/src/index.ts index 3b4bb3e..78d55ec 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -14,6 +14,38 @@ server.get("/", function (request, reply) { reply.code(200).send("Hello, World!"); }); +server.route({ + method: "POST", + url: "/GetImage", + schema: { + body: { + type: "object", + properties: { + sessionImages: { + type: "array", + items: { type: "number" }, + }, + }, + }, + response: { + 200: { + type: "object", + properties: { + id: { type: "number" }, + image: { type: "string" }, + }, + }, + }, + }, + handler: function (request, reply) { + reply.send({ + id: 0, + image: + "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAA3SURBVBhXYyAXeHh43AeDhIQEqBAEAIX+g8H379+hQhAAlwACqBAEVFRUQESnT58OFSIRMDAAABZDJ2qjC6hLAAAAAElFTkSuQmCC", + }); + }, +}); + server.listen(process.env.PORT as string, "0.0.0.0", function (err, address) { if (err) { server.log.error(err); -- GitLab