mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
* feat: retreive stripe public key via runtime environment variable instead of a build-time environment variable * feat: retreive google and github enabled environment variable via runtime environment variable instead of a build-time environment variable * feat: retreive app base url environment variable via runtime environment variable instead of a build-time environment variable * feat: retreive mixpanel token environment variable via runtime environment variable instead of a build-time environment variable * lazy initialize app info * feat: provide ga tarcking id and crisp website id via environment variable * make docs url optional * feat: load sentry config from environment variables * document hive app environment variables * add application dockerfile * add docker build instructions * lul * set working directory * pls fix * lol this is apollo-router not graphql-hive * feat: only show sentry stuff if sentry environment variables are set * use LTS node version * No mixpanel * Fallback Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { superTokensNextWrapper } from 'supertokens-node/nextjs';
|
|
import { middleware } from 'supertokens-node/framework/express';
|
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
import { Request, Response } from 'express';
|
|
import supertokens from 'supertokens-node';
|
|
import { backendConfig } from '@/config/backend-config';
|
|
import NextCors from 'nextjs-cors';
|
|
|
|
supertokens.init(backendConfig());
|
|
|
|
/**
|
|
* Route for proxying to the underlying SuperTokens backend.
|
|
*/
|
|
export default async function superTokens(req: NextApiRequest & Request, res: NextApiResponse & Response) {
|
|
// NOTE: We need CORS only if we are querying the APIs from a different origin
|
|
await NextCors(req, res, {
|
|
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'],
|
|
origin: process.env['APP_BASE_URL'],
|
|
credentials: true,
|
|
allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()],
|
|
});
|
|
|
|
await superTokensNextWrapper(
|
|
async next => {
|
|
await middleware()(req, res, next);
|
|
},
|
|
req,
|
|
res
|
|
);
|
|
|
|
if (!res.writableEnded) {
|
|
res.status(404).send('Not found');
|
|
}
|
|
}
|