SpaceAPI: custom endpoint

This commit is contained in:
He4eT 2025-04-02 15:54:14 +02:00
commit d7a40831d0
2 changed files with 25 additions and 0 deletions

View file

@ -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);
},
});

View file

@ -0,0 +1,12 @@
export default {
routes: [
{
method: 'GET',
path: '/spaceapi',
handler: 'spaceapi.index',
config: {
auth: false,
},
}
]
}