mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 13:25:19 +00:00
Updated examples README
This commit is contained in:
@@ -11,7 +11,8 @@ This example offers just the generation of a single static `boardingPass`.
|
|||||||
|
|
||||||
## Setting up
|
## Setting up
|
||||||
|
|
||||||
Install all the dependencies through `npm install`.
|
Install the dependencies from wherever path you are with `pnpm install`. Installing the dependencies will link passkit-generator in the parent workspace, so to reflect any change, it will be enough to build passkit-generator and restart the example.
|
||||||
|
|
||||||
Configure wrangler and your account [according to the guide](https://developers.cloudflare.com/workers/get-started/guide).
|
Configure wrangler and your account [according to the guide](https://developers.cloudflare.com/workers/get-started/guide).
|
||||||
You are always suggested to start with a brand new project and to not clone this one, so that you won't miss any configuration you might need.
|
You are always suggested to start with a brand new project and to not clone this one, so that you won't miss any configuration you might need.
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ This example uses some environmental variables (secrets), which can be set throu
|
|||||||
So, assuming you have `certificates` folder in the root of passkit-generator and all the dependencies installed, you'll be able to directly inject your secrets into wrangler by doing this.
|
So, assuming you have `certificates` folder in the root of passkit-generator and all the dependencies installed, you'll be able to directly inject your secrets into wrangler by doing this.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ cat ../../../certificates/signerKey.pem | npx wrangler secret put SIGNER_KEY
|
$ cat ../../../certificates/signerKey.pem | pnpm wrangler secret put SIGNER_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
These variables are exposed on `env` when performing the request.
|
These variables are exposed on `env` when performing the request.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@ This is examples folder. These examples are used to test new features and as sam
|
|||||||
|
|
||||||
Each example owns an endpoint where a pass can be reached. This project is built upon Express.js.
|
Each example owns an endpoint where a pass can be reached. This project is built upon Express.js.
|
||||||
|
|
||||||
Typescript compilation is done automatically through `ts-node`.
|
Typescript compilation is done automatically through `tsx`.
|
||||||
|
|
||||||
Before generating a new pass, you'll have to override the `passTypeIdentifier` and `teamIdentifier` for them to match the data in your certificates. This can be done in two ways:
|
Before generating a new pass, you'll have to override the `passTypeIdentifier` and `teamIdentifier` for them to match the data in your certificates. This can be done in two ways:
|
||||||
|
|
||||||
@@ -13,11 +13,12 @@ Before generating a new pass, you'll have to override the `passTypeIdentifier` a
|
|||||||
|
|
||||||
Omitting this step, will make your pass unopenable.
|
Omitting this step, will make your pass unopenable.
|
||||||
|
|
||||||
Assuming you already installed this project its dependencies through `npm install` and moved to `examples/self-hosted`, run these commands:
|
Install the dependencies from wherever path you are with `pnpm install`. Installing the dependencies will link passkit-generator in the parent workspace, so to reflect any change, it will be enough to build passkit-generator and restart the example.
|
||||||
|
|
||||||
|
Then be sure to be placed in this folder (`examples/self-hosted`) and run this command to run the web server:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install;
|
$ pnpm example;
|
||||||
$ npm run example;
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Certificates paths in examples are linked to a folder `certificates` in the root of this project which is not provided.
|
Certificates paths in examples are linked to a folder `certificates` in the root of this project which is not provided.
|
||||||
@@ -25,7 +26,7 @@ To make them work, you'll have to edit both certificates and model path.
|
|||||||
|
|
||||||
Every example runs on `0.0.0.0:8080`. Visit `http://localhost:8080/:example/:modelName`, by replacing `:example` with one of the following and `:modelName` with one inside models folder.
|
Every example runs on `0.0.0.0:8080`. Visit `http://localhost:8080/:example/:modelName`, by replacing `:example` with one of the following and `:modelName` with one inside models folder.
|
||||||
|
|
||||||
Please note that `field.js` example will force you to download `exampleBooking.pass`, no matter what.
|
Please note that `field.js` example is hardcoded to download `exampleBooking.pass`.
|
||||||
|
|
||||||
| Example name | Endpoint name | Additional notes |
|
| Example name | Endpoint name | Additional notes |
|
||||||
| -------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
| -------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ These examples are basically made for being executed locally. In the file `confi
|
|||||||
|
|
||||||
## Run examples
|
## Run examples
|
||||||
|
|
||||||
Install the dependencies and run serverless. Installing the dependencies will link the latest version of passkit-generator in the parent workspace.
|
Install the dependencies from wherever path you are and run serverless. Installing the dependencies will link passkit-generator in the parent workspace, so to reflect any change, it will be enough to build passkit-generator and restart the example.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install;
|
$ pnpm install;
|
||||||
$ npm run example;
|
$ pnpm example;
|
||||||
```
|
```
|
||||||
|
|
||||||
This will start `serverless offline` with an additional host option (mainly for WSL environment).
|
This will start `serverless offline` with an additional host option (mainly for WSL environment).
|
||||||
|
|||||||
Reference in New Issue
Block a user