backend/src/index.ts (view raw)
1import bootstrapActions from "./bootstrap";
2import graphqlExtends from "./graphql";
3
4export default {
5 /**
6 * An asynchronous register function that runs before
7 * your application is initialized.
8 *
9 * This gives you an opportunity to extend code.
10 */
11 register(context) {
12 graphqlExtends(context);
13
14 // Disable REST endpoints
15 context.strapi.controller("api::event.event").find = (ctx) =>
16 ctx.unauthorized();
17 context.strapi.controller("api::passenger.passenger").find = (ctx) =>
18 ctx.unauthorized();
19 context.strapi.controller("api::travel.travel").find = (ctx) =>
20 ctx.unauthorized();
21 context.strapi.controller("api::vehicle.vehicle").find = (ctx) =>
22 ctx.unauthorized();
23 context.strapi.controller("plugin::users-permissions.user").find = (ctx) =>
24 ctx.unauthorized();
25 },
26
27 /**
28 * An asynchronous bootstrap function that runs before
29 * your application gets started.
30 *
31 * This gives you an opportunity to set up your data model,
32 * run jobs, or perform some special logic.
33 */
34 async bootstrap(context) {
35 for (let action of bootstrapActions) {
36 await action(context);
37 }
38 },
39};