Skip to content

Commit

Permalink
feat: health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRivers committed Feb 14, 2024
1 parent 5d289d8 commit 2c00a66
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/handlers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {createOrg} from './createOrg';
import {login} from './login';
import {logout} from './logout';
import {setup} from './setup';
import {health} from './health';
import {register} from './register';
import AppRouterClient from '../routerClients/AppRouterClient';
import PagesRouterClient from '../routerClients/PagesRouterClient';
Expand All @@ -19,6 +20,7 @@ const routeMap = {
setup,
login,
logout,
health,
kinde_callback: callback
};

Expand Down
22 changes: 22 additions & 0 deletions src/handlers/health.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import RouterClient from '../routerClients/RouterClient';
import { config } from '../config/index'
import { NextResponse } from "next/server";

/**
*
* @returns NextResponse
*/
export const health = async () => {
return NextResponse.json({
apiPath: config.apiPath,
redirectURL: config.clientOptions.redirectURL,
postLoginRedirectURL: config.postLoginRedirectURL,
issuerURL: config.issuerURL,
clientID: config.clientID,
clientSecret: config.clientSecret.match('[a-z0-9]{32}') ? 'Set correctly' : 'Not set correctly',
postLogoutRedirectURL: config.postLogoutRedirectURL,
audience: config.audience,
cookieDomain: config.cookieDomain,
logoutRedirectURL: config.clientOptions.logoutRedirectURL
});
};

0 comments on commit 2c00a66

Please sign in to comment.