Added Paginated Endpoint
Reformatted Code
This commit is contained in:
16
src/index.ts
16
src/index.ts
@@ -10,6 +10,7 @@ import authRoutesAuthenticated from "./routes/auth/auth-authenticated";
|
||||
import authPlugin from "./plugins/auth";
|
||||
import adminRoutes from "./routes/admin";
|
||||
import corsPlugin from "./plugins/cors";
|
||||
import queryConfigPlugin from "./plugins/queryconfig";
|
||||
import resourceRoutes from "./routes/resources";
|
||||
import resourceRoutesSpecial from "./routes/resourcesSpecial";
|
||||
import fastifyCookie from "@fastify/cookie";
|
||||
@@ -20,6 +21,7 @@ import functionRoutes from "./routes/functions";
|
||||
import bankingRoutes from "./routes/banking";
|
||||
import exportRoutes from "./routes/exports"
|
||||
import emailAsUserRoutes from "./routes/emailAsUser";
|
||||
import authProfilesRoutes from "./routes/profiles";
|
||||
|
||||
import {sendMail} from "./utils/mailer";
|
||||
import {loadSecrets, secrets} from "./utils/secrets";
|
||||
@@ -27,7 +29,7 @@ import {initMailer} from "./utils/mailer"
|
||||
import {initS3} from "./utils/s3";
|
||||
|
||||
async function main() {
|
||||
const app = Fastify({ logger: true });
|
||||
const app = Fastify({ logger: false });
|
||||
await loadSecrets();
|
||||
await initMailer();
|
||||
await initS3();
|
||||
@@ -42,6 +44,17 @@ async function main() {
|
||||
await app.register(corsPlugin);
|
||||
await app.register(supabasePlugin);
|
||||
await app.register(tenantPlugin);
|
||||
|
||||
app.addHook('preHandler', (req, reply, done) => {
|
||||
console.log('Matched path:', req.routeOptions.url)
|
||||
done()
|
||||
})
|
||||
|
||||
//Plugin nur auf bestimmten Routes
|
||||
await app.register(queryConfigPlugin, {
|
||||
routes: ['/api/resource/:resource/paginated']
|
||||
})
|
||||
|
||||
app.register(fastifyCookie, {
|
||||
secret: secrets.COOKIE_SECRET,
|
||||
})
|
||||
@@ -68,6 +81,7 @@ async function main() {
|
||||
await subApp.register(bankingRoutes);
|
||||
await subApp.register(exportRoutes);
|
||||
await subApp.register(emailAsUserRoutes);
|
||||
await subApp.register(authProfilesRoutes);
|
||||
|
||||
},{prefix: "/api"})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user