how to deploy already created project worker wrangler?
any one help me to deploy my full stack proejct with worker
5 Replies
Hey Skins, do you already have a wrangler.toml, or are you configuring things from dash?
i created wrangler.json
just used sample
{
"name": "my-worker",
"main": "src/index.js",
"compatibility_date": "2022-07-12",
"workers_dev": false,
"route": {
"pattern": "example.org/",
"zone_name": "example.org"
},
"kv_namespaces": [
{
"binding": "<MY_NAMESPACE>",
"id": "<KV_ID>"
}
],
"env": {
"staging": {
"name": "my-worker-staging",
"route": {
"pattern": "staging.example.org/",
"zone_name": "example.org"
},
"kv_namespaces": [
{
"binding": "<MY_NAMESPACE>",
"id": "<STAGING_KV_ID>"
}
]
}
}
}
Cool, yeah you can just run
npx wrangler deploy
and it will do the upload 🙂
add a -e staging
if you want to deploy to the staging worker instead"add a -e staging if you want to deploy to the staging worker instead" can explain more
Your wrangler.json file specifies a staging environment. If you run
npx wrangler deploy -e staging
it will deploy my-worker-staging
with the specified route and kv binding