diff --git a/src/api/spaceapi/controllers/spaceapi.ts b/src/api/spaceapi/controllers/spaceapi.ts new file mode 100644 index 0000000..38645f3 --- /dev/null +++ b/src/api/spaceapi/controllers/spaceapi.ts @@ -0,0 +1,13 @@ +import type { Core } from '@strapi/strapi'; +import type { Context } from 'koa'; + +export default ({ strapi }: { strapi: Core.Strapi }) => ({ + async index(ctx: Context) { + const hackspace = await strapi.documents('api::hackspace.hackspace') + .findFirst({ + populate: "*", + }); + + return ctx.send(hackspace); + }, +}); diff --git a/src/api/spaceapi/routes/spaceapi.ts b/src/api/spaceapi/routes/spaceapi.ts new file mode 100644 index 0000000..302cdc6 --- /dev/null +++ b/src/api/spaceapi/routes/spaceapi.ts @@ -0,0 +1,12 @@ +export default { + routes: [ + { + method: 'GET', + path: '/spaceapi', + handler: 'spaceapi.index', + config: { + auth: false, + }, + } + ] +}