Skip to content

Commit 437e9f9

Browse files
authored
Merge pull request #11 from fastly/kats/cli-deps
Use @fastly/cli in the starter kit
2 parents 4115121 + 36a4f49 commit 437e9f9

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ This starter kit makes it possible to define custom request handling logic at th
1818

1919
✅ Improved API security
2020

21-
## Usage
21+
## Running the application
22+
23+
To create an application using this starter kit, create a new directory for your application and switch to it, and then type the following command:
24+
25+
```shell
26+
npm create @fastly/compute@latest -- --language=javascript --starter-kit=openapi-validation
27+
```
2228

2329
Replace the contents of `src/definition.json` with your own OpenAPI 3.x definition, and change any references to `httpbin.org` to your origin in `fastly.toml` – by replacing the `url` in `local_server.backends.origin`, and the `address` (hostname) in `setup.backends.origin`.
2430

25-
Then run `fastly compute serve` to try out this Compute app on your local machine, or `fastly compute publish` to publish a new Compute service.
31+
To build and run your new application in the local development environment, type the following command:
32+
33+
```shell
34+
npm run start
35+
```
36+
37+
To build and deploy your application to your Fastly account, type the following command. The first time you deploy the application, you will be prompted to create a new service in your account.
38+
39+
```shell
40+
npm run deploy
41+
```
2642

2743
### Request handling
2844

fastly.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ name = "OpenAPI Validation (JS)"
99

1010
[scripts]
1111
build = "npm run build"
12+
post_init = "npm install"
1213

1314
[local_server]
1415
[local_server.backends]

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"node": "^18"
44
},
55
"devDependencies": {
6+
"@fastly/cli": "^10.14.0",
67
"buffer": "^6.0.3",
78
"core-js": "^3.33.1",
89
"g": "^2.0.1",
@@ -20,6 +21,7 @@
2021
"scripts": {
2122
"prebuild": "webpack",
2223
"build": "js-compute-runtime bin/index.js bin/main.wasm",
24+
"start": "fastly compute serve",
2325
"deploy": "fastly compute publish"
2426
}
2527
}

0 commit comments

Comments
 (0)