wrangler init should populate example code
See original GitHub issueAfter running wrangler init
, no example code is provided (index.js
or index.ts
depending if they asked for TypeScript or not). It should populate a basic starter file. In the future, we can make this more complex by introducing different templates to choose from.
src/index.ts
:
export default {
async fetch(request: Request, env: Environment, ctx: ExecutionContext): Promise<Response> {
return new Response("Hello!");
}
}
export type Environment = {
// MY_NAMESPACE: KvNamespace;
}
src/index.js
:
export default {
async fetch(request, env, ctx) {
return new Response("Hello!");
}
}
Also, should probably have a comment that links to the reference documentation?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Get started guide · Cloudflare Workers docs
After running the wrangler init command to generate your Worker, the index.js file will be populated with the code below: export default {....
Read more >RFC/Spec: wrangler init with flag --from-dash #1623 - GitHub
This implementation should be agnostic from any source control & storage. Encourage augmenting projects, i.e. TypeScript, and source storage (we currently ...
Read more >Create a Cloudflare Worker with the Wrangler CLI | egghead.io
[0:27] Type npx wrangler init to create a new Wrangler project. I'm going to name mine Supabase at the Edge. This will step...
Read more >Using LaunchDarkly with Cloudflare Workers
Wrangler generates a Cloudflare Worker for you. The Worker contains a lot of extraneous code that you don't need for this guide.
Read more >Deploy a React App with Cloudflare Workers Sites
In this tutorial, we'll use Wrangler and Cloudflare Workers to ... is a great platform to deploy static sites: your application will be ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/cloudflare/wrangler2/pull/372
I like the idea of an entry point. Ok let’s try something and see how it feels.