route.ts

src/app/api/is-logged-in/route.ts
import { NextResponse } from 'next/server'
const WP_JSON = (process.env.NEXT_PUBLIC_WORDPRESS_URL ? `${process.env.NEXT_PUBLIC_WORDPRESS_URL}/wp-json` : undefined) || ''
export async function POST(req: Request) {
if (!WP_JSON) {
return NextResponse.json(
{ error: 'NEXT_PUBLIC_WORDPRESS_URL not configured' },
{ status: 500 }
)
}
const { username, password } = await req.json()
try {
const res = await fetch(`${WP_JSON}/gallop/v1/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password }),
})

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC