That doesn't define a D1 database for the `dev` env, fwiw
That doesn't define a D1 database for the
dev env, fwiwnpx wrangler d1 execute audition --command "SELECT * FROM _some_table_;" --local does that work?/favicon.ico_routes.json like: _routes is Pages specific, not for Workers generically, but yesgetRequestContext for next on pages, idk how you haven't stumbled upon itgetRequestContext is for prod environment specifically, but it also should work on local if im not mistaken.env getRequestContext().env and couple of other cloudflare related things, such as city and country of the request origin

4/6/24, 2:08 PM
near "SET": syntax error at offset 196 [code: 7500]wrangler d1 execute 10Database --file=database.sql
npx wrangler d1 execute audition --command "SELECT * FROM _some_table_;" --local/favicon.ico_routes.json{
"version": 1,
"include": ["/api/*"],
"exclude": ["/*.*"]
}_routesgetRequestContextgetRequestContextgetRequestContext().envnear "SET": syntax error at offset 196 [code: 7500]wrangler d1 execute 10Database --file=database.sqlconst url = new URL(request.url);
if (url.pathname === '/something') {
// do your work
}addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
if (request.method === 'POST') {
// Parse form data from the request
const formData = await request.formData();
const user = formData.get('User');
const quote = formData.get('Quote');
const date = parseInt(formData.get('date'));
const visibility = parseInt(formData.get('visibility'));
// Send data to D1 database
const response = await fetch('https://quote.logozip18.workers.dev/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'POST',
'Access-Control-Allow-Headers': 'Content-Type',
},
body: JSON.stringify({ user, quote, date, visibility }),
});
if (response.ok) {
return new Response('Data submitted successfully!', { status: 200 });
} else {
return new Response('Error submitting data to database', { status: 500 });
}
} else {
return new Response('Method not allowed', { status: 405 });
}
}