Duplicates
Latest version
Current behavior 😯
Expected behavior 🤔
Steps to reproduce 🕹
Steps:
- Configuring
app.config.ts
defineConfig({
server: {
baseURL:"/the_project",
},
});
- Create a file
src/routes/api/info.ts
import type { APIHandler } from '@solidjs/start/server';
export const POST: APIHandler = async (event) => {
return {
name: 'John POST',
};
};
- fetch api
fetch("/the_project/api/info", {
"method": "POST",
});
Context 🔦
After debugging, I think the bug is here
|
const match = matchAPIRoute(new URL(event.request.url).pathname, event.request.method); |
new URL(event.request.url).pathname = /the_project/api/info ,but in router is /api/info
|
const match = router.lookup(path); |
After modification, it can run normally
const match = matchAPIRoute(event.nativeEvent.path, event.request.method);
Your environment 🌎
Duplicates
Latest version
Current behavior 😯
Expected behavior 🤔
Steps to reproduce 🕹
Steps:
app.config.tssrc/routes/api/info.tsContext 🔦
After debugging, I think the bug is here
solid-start/packages/start/src/server/handler.ts
Line 47 in 28e3fc5
new URL(event.request.url).pathname=/the_project/api/info,but inrouteris/api/infosolid-start/packages/start/src/router/routes.ts
Line 61 in 28e3fc5
After modification, it can run normally
Your environment 🌎