mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Added first version of serverless-based implementation example
This commit is contained in:
52
examples/serverless/README.md
Normal file
52
examples/serverless/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Serverless Examples
|
||||
|
||||
This is a sample project for showing passkit-generator being used on cloud functions.
|
||||
|
||||
Typescript compilation happens automatically through `serverless-plugin-typescript` when serverless is started.
|
||||
|
||||
## Configuration
|
||||
|
||||
These examples are basically made for being executed locally. In the file `config.json`, some constants can be customized.
|
||||
|
||||
```json
|
||||
/** Passkit signerKey passphrase **/
|
||||
"SIGNER_KEY_PASSPHRASE": "123456",
|
||||
|
||||
/** Bucket name where a pass is saved before being served. */
|
||||
"PASSES_S3_TEMP_BUCKET": "pkge-test",
|
||||
|
||||
/** S3 Access key ID - "S3RVER" is default for `serverless-s3-local`. If this example is run offline, "S3RVER" will always be used. */
|
||||
"ACCESS_KEY_ID": "S3RVER",
|
||||
|
||||
/** S3 Secret - "S3RVER" is default for `serverless-s3-local` */
|
||||
"SECRET_ACCESS_KEY": "S3RVER",
|
||||
|
||||
/** Bucket that contains pass models **/
|
||||
"MODELS_S3_BUCKET": "pkge-mdbk"
|
||||
```
|
||||
|
||||
## Run examples
|
||||
|
||||
Install the dependencies and run serverless. Installing the dependencies will link the latest version of passkit-generator in the parent workspace.
|
||||
|
||||
```sh
|
||||
$ npm install;
|
||||
$ npm run run-offline;
|
||||
```
|
||||
|
||||
This will start `serverless offline` with an additional host option (mainly for WSL environment).
|
||||
Serverless will start, by default, on `0.0.0.0:8080`.
|
||||
|
||||
### Available examples
|
||||
|
||||
All the examples, except fields ones, require a `modelName` to be passed in queryString. The name will be checked against local FS or S3 bucket if example is deployed.
|
||||
Pass in queryString all the pass props you want to apply them to the final result.
|
||||
|
||||
| Example name | Endpoint name | Additional notes |
|
||||
| -------------- | ----------------- | ----------------------------------------------------------------------------------------------------- |
|
||||
| localize | `/localize` | - |
|
||||
| fields | `/fields` | - |
|
||||
| expirationDate | `/expirationDate` | - |
|
||||
| scratch | `/scratch` | - |
|
||||
| barcodes | `/barcodes` | Using `?alt=true` query parameter, will lead to barcode string message usage instead of selected ones |
|
||||
| pkpasses | `/pkpasses` | - |
|
||||
Reference in New Issue
Block a user