Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/travis-r6s/worker-shopify-template
https://github.com/travis-r6s/worker-shopify-template
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/travis-r6s/worker-shopify-template
- Owner: travis-r6s
- Created: 2021-01-27T17:40:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-27T17:47:24.000Z (almost 4 years ago)
- Last Synced: 2023-12-27T13:38:53.718Z (about 1 year ago)
- Language: TypeScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `workers-shopify-template`
A batteries included template for kick starting a TypeScript Cloudflare worker project, for use in a Shopify App - mostly borrowed from the official TS starter, and this article: [https://medium.com/@chris.dascoli/lets-build-a-shopify-app-c5f075fd6a78](https://medium.com/@chris.dascoli/lets-build-a-shopify-app-c5f075fd6a78) (thanks!).
## ๐ Getting Started
This template is meant to be used with [Wrangler](https://github.com/cloudflare/wrangler). If you are not already familiar with the tool, we recommend that you install the tool and configure it to work with your [Cloudflare account](https://dash.cloudflare.com). Documentation can be found [here](https://developers.cloudflare.com/workers/tooling/wrangler/).
To generate using Wrangler, run this command:
```bash
wrangler generate my-app-project https://github.com/thetre97/worker-shopify-template
```### ๐ฉ ๐ป Developing
Add your account ID in `wrangler.toml`, and add some env's to Cloudflare:
```sh
wrangler secret put SHOPIFY_APP_URL
wrangler secret put SHOPIFY_API_KEY
wrangler secret put SHOPIFY_API_SECRET
```And then run `wrangler dev`.
### ๐งช Testing
This template comes with mocha tests which simply test that the request handler can handle each request method. `yarn test` will run your tests.
### โ๏ธ Linting
This template uses ESLint to lint the project. To invoke, run `yarn lint`.
### ๐ Previewing and Publishing
To publish, just run `wrangler publish`.
## โ ๏ธ Caveats
The `service-worker-mock` used by the tests is not a perfect representation of the Cloudflare Workers runtime. It is a general approximation. We recommend that you test end to end with `wrangler dev` in addition to a [staging environment](https://developers.cloudflare.com/workers/tooling/wrangler/configuration/environments/) to test things before deploying.