Code Monkey home page Code Monkey logo

wrangler's Introduction

๐Ÿค  wrangler

Banner

crates.io ย  Build Status

wrangler is a CLI tool designed for folks who are interested in using Cloudflare Workers.

Wrangler Demo

Installation

You have many options to install wrangler!

Install with npm

npm i @cloudflare/wrangler -g

Install with cargo

cargo install wrangler

If you don't have cargo or npm installed, you will need to follow these additional instructions.

Updating

For information regarding updating Wrangler, click here.

Getting Started

Once you have installed Wrangler, spinning up and deploying your first Worker is easy!

$ wrangler generate my-worker
$ cd my-worker
# update your wrangler.toml with your Cloudflare Account ID
$ wrangler config
$ wrangler publish

๐ŸŽ™๏ธ Top Level Commands

๐Ÿ‘ฏ generate

Scaffold a project, including boilerplate code for a Rust library and a Cloudflare Worker.

wrangler generate <name> <template> --type=["webpack", "javascript", "rust"]

All of the arguments and flags to this command are optional:

๐Ÿ“ฅ init

Creates a skeleton wrangler.toml in an existing directory. This can be used as an alternative to generate if you prefer to clone a repository yourself.

wrangler init <name> --type=["webpack", "javascript", "rust"]

All of the arguments and flags to this command are optional:

  • name: defaults to the name of your working directory
  • type: defaults to "webpack".

๐Ÿฆ€โš™๏ธ build

Build your project. This command looks at your wrangler.toml file and runs the build steps associated with the "type" declared there.

Additionally, you can configure different environments.

๐Ÿ”ง config

Configure your global Cloudflare user. This is an interactive command that will prompt you for your API token:

wrangler config
Enter API token:
superlongapitoken

You can also provide your email and global API key (this is not recommended for security reasons):

wrangler config --api-key
Enter email:
[email protected]
Enter global API key:
superlongapikey

You can also use environment variables to configure these values.

โ˜๏ธ ๐Ÿ†™ publish

Publish your Worker to Cloudflare. Several keys in your wrangler.toml determine whether you are publishing to a workers.dev subdomain or your own registered domain, proxied through Cloudflare.

Additionally, you can configure different environments.

You can also use environment variables to handle authentication when you publish a Worker.

# e.g.
CF_API_TOKEN=superlongtoken wrangler publish
# where
# $CF_API_TOKEN -> your Cloudflare API token

CF_API_KEY=superlongapikey [email protected] wrangler publish
# where
# $CF_API_KEY -> your Cloudflare API key
# $CF_EMAIL -> your Cloudflare account email

๐Ÿ—‚ kv

Interact with your Workers KV store. This is actually a whole suite of subcommands. Read more about in Wrangler KV Documentation.

Additional Documentation

All information regarding wrangler or Cloudflare Workers is located in the Cloudflare Workers Developer Docs. This includes:

  • Using wrangler commands
  • Wrangler configuration
  • General documentation surrounding Workers development
  • All wrangler features such as Workers Sites and KV

โœจWorkers Sites

To learn about deploying static assets using wrangler, see the Workers Sites Quickstart.

wrangler's People

Contributors

everlastingbugstopper avatar ashleygwilliams avatar ashleymichal avatar xtuc avatar gabbifish avatar xortive avatar kristianfreeman avatar exvuma avatar pradovic avatar electroid avatar steveklabnik avatar stevenfranks avatar aarono avatar adaptive avatar zackbloom avatar hffmnn avatar neynah avatar jaysonsantos avatar bradyjoslin avatar 0xflotus avatar yumazak avatar tombyrer avatar rita3ko avatar dentarg avatar phayes avatar 56quarters avatar elithrar avatar third774 avatar kentonv avatar defjosiah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.