Skip to content

Commit

Permalink
added a separate healtcheck api endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
parsa-asgari committed Apr 1, 2024
1 parent 49c5c76 commit 1483898
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/api/healthcheck/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { NextResponse } from "next/server";


export async function GET(req: Request){
return NextResponse.json({status: 1}, { status: 200});
}
3 changes: 3 additions & 0 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ export async function middleware(request: NextRequest) {
// OPTIONAL: this forces users to be logged in to use the chatbot.
// If you want to allow anonymous users, simply remove the check below.
const user_id = request.nextUrl.searchParams.get('user_id')
if (request.url.includes('/api/healthcheck')){
return response
}
if (
!session.session &&
!request.url.includes('/sign-in') &&
Expand Down

0 comments on commit 1483898

Please sign in to comment.