Help With _routes.json File

Hello, I am a bit confused by the _routes.json file. I have added the file to my functions directory with the following config:
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
I have another file [article].ts in my functions folder with the following code, for testing purposes:
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
My understanding of the _routes.json is that I should not see a Hit log for when I visit my Pages site at http://localhost:8788, however, I see Hit: manifest.json in the logs (nothing for the index route itself). Why is this? Essentially, what I am after is for the static page to load for /, but then all other routes to fallback to my [article].ts function.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server