question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wrangler init should populate example code

See original GitHub issue

After 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
threepointonecommented, Jan 31, 2022

I like the idea of an entry point. Ok let’s try something and see how it feels.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found