using dashboard for local development
Hi
I am very new to web development, js, ts and cloudflare workers so forgive me if this question doesnt make sense.
It seems there are multiple ways to develop workers. One is via the dashboard, and the other is locally.
I started with the dashboard, but now switched to local developent as it seems to be the way to go (e.g. i dont know how to add external dependencies via the dashbaord).
I created a ts worker locally and the code loosk readable. When i open the dashboard, the code is autogenerated js code that is unreadable.
However there are certain tools that i would like to use from the dashboard, namely
- the v8 inspector
- being able to send various HTTP requests easily (e.g. sending a POST) (instead of requiring postman or similar)
Is there any way i can programm locally, and test on my localhost, but still make use of these tools?
i attached an image of the panel i mean
basically, is there any way to use this panel or something similar in local development (i use vscode)
6 Replies
i am struggling, because if i test localy, it opens in chrome, and it seems i can use node dev tools to inspect the console.
but since i open it in chrome, i can only access my worker via GET requests (or can you send different requests?)
alternatively, i can easily send POST request via postman, but then i cant use node dev tools or any kind of dev tools?
ok i played around a bit more, it seems the best solution is to open the dev tools
and then have postman on the side to send them
im leaving the question open to see if there are maybe any other suggestions
when you develop locally, you'll want to run your function with cloudflare's cli called 'wrangler' this tool will run your function locally and you can use postman or httpie to make reqeusts to your locally running function. once you're happy with testing you can deploy the function to cloudflare.
the reason your function goes from typescript to 'generated' javascript is because you are transpiling typescript to javascript. this is a normal thing that happens. node can't natively run typescript so it needs to be transpiled to javascript during a build process
Get started guide · Cloudflare Workers docs
This guide will instruct you through setting up and deploying your first Worker.
read that page as it shows you how to use wrangler. it's pretty much a thing you have to learn if you want to run stuff locally the cloudflare way
thanks for the information, ill take a look