is it recommended calling directly, or via npx? (I know virtually zero about npm and npx)
is it recommended calling directly, or via npx?
(I know virtually zero about npm and npx)
(I know virtually zero about npm and npx)
npm doesn't actually support that for arbitrary commands, so npx would probably be the next best thing.pnpm for arbitrary command execution using the locally installed package: pnpm wrangler deploy [whatever]satisfies in your workers?request: Request, env: Envsatisfies ExportedHandler<Env> 
ExportedHandler : Promise<Response> for better DX, and then satisfies ExportedHandler<Env>;queue handlers don't need to return anything so: Promise<void> works wellsatisfies operatore introduced in TypeScript 4.9 shouldn't just check that the function matches expect class?batch is of type MessageBatch?ExportedHandler takes other generic types, included one for MessageBatchsatisfies covers most of the function. But the return type being explicit creates better errors for DX.ExportedHandler<Env, MessageBatch> for examplesatisfies Env in the index.ts even tho now that's automatically generated in worker-configuration.d.tswrangler types tho
fetch as : Promise<Response> so ts will catch if you ever accidentally return something elseResponse | Promise<Response> is implied from implements DurableObjectwrangler dev --remote the preview_database_id is used. Perfect! However, when running wrangler dev the preview_database_id is used. wrangler dev the database_id is used.npmnpxpnpmpnpm wrangler deploy [whatever]satisfiessatisfiessatisfiessatisfiesrequest: Requestenv: Envsatisfies ExportedHandler<Env>ExportedHandlerExportedHandler: Promise<Response>: Promise<Response>satisfies ExportedHandler<Env>;queuePromise<void>batchMessageBatchMessageBatchExportedHandler<Env, MessageBatch>Envindex.tsworker-configuration.d.tswrangler typesfetchResponse | Promise<Response>implements DurableObjectwrangler dev --remotewrangler devwrangler devexport default {
async fetch(request, env, ctx): Promise<Response> {
// do things
},
} satisfies ExportedHandler<Env>;# wrangler.toml
# ...
routes = [
{ pattern = "example.test/api*", zone_name = "example.test" },
{ pattern = "localhost:4321/api*", zone_name = "localhost" },
]d1_databases = [
{ binding = "DB", database_name = "mydb", database_id = "id1", preview_database_id = "id2" },
]d1_databases = [
{ binding = "DB", database_name = "mydb", database_id = "id1" },
]