Hi there,
I try to work with Astro front-end, and i’ve juste installed minimum required (astro, npm, vercel) on Windows and put a test.js in ./src/pages/api/test.js like :
export async function POST() {
return new Response(JSON.stringify({ message: ‘ok’ }), {
headers: { ‘Content-Type’: ‘application/json’ },
status: 200,
});
}
In localhost that’s ok, BUT : after deployment, when i go to my webstite http://------.app/api/test, i get 404 error : not found.
Could anyone tell me please how to put a basic API (serverless or not, i’ve got the default config with astro) in Vercel ?
astro.config.mjs (standard) :
“”"
import { defineConfig } from ‘astro/config’;
import vercel from ‘@astrojs/vercel’;
export default defineConfig({
adapter: vercel(), //
site: ‘https://xxxxxxx.app’,
});
“”"
And i’ve also noticed that with Sanity studio, sanity hook is not triggering full rebuild when for example creating a new page in sanity, which creates also 404 error because on Vercel we see “prebuilt”, but not true build.
I’m searching for days… thanks for any help ! ![]()