Skip to content

Commit 0fa6a02

Browse files
committed
updates
1 parent d220dc5 commit 0fa6a02

File tree

27 files changed

+46816
-3848
lines changed

27 files changed

+46816
-3848
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.DS_Store
33

44
# Default TypeSpec output
5-
tsp-output/
65
dist/
76

87
# Dependency directories

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Build
22

33
on:
4-
- push
5-
- pull_request
4+
push
5+
branches:
6+
- main
7+
68

79
jobs:
810
build:

Caddyfile

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
http://localhost:8080
22

3+
route / {
4+
reverse_proxy localhost:4010
5+
}
6+
7+
route /http-api/echo {
8+
reverse_proxy localhost:4010
9+
}
10+
11+
route /http-api/openapi {
12+
reverse_proxy localhost:4010
13+
}
14+
15+
route /http-protocol/openapi {
16+
reverse_proxy localhost:4010
17+
}
18+
19+
route /js-playwright/openapi {
20+
reverse_proxy localhost:4010
21+
}
22+
23+
route /postman/openapi {
24+
reverse_proxy localhost:4010
25+
}
26+
327
route /assets {
428
reverse_proxy localhost:4010
529
}
630

7-
route /http-protocol/example {
31+
route /http-api/example {
832
reverse_proxy localhost:4010
933
}
1034

@@ -42,12 +66,12 @@ route /http-protocol/* {
4266
reverse_proxy localhost:4011
4367
}
4468

45-
route /http-playwright/* {
46-
uri strip_prefix /http-playwright
69+
route /js-playwright/* {
70+
uri strip_prefix /playwright
4771
reverse_proxy localhost:4012
4872
}
4973

50-
route /http-postman/* {
51-
uri strip_prefix /http-postman
74+
route /postman/* {
75+
uri strip_prefix /postman
5276
reverse_proxy localhost:4013
5377
}

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM node:22-alpine
22

3-
ARG NODE_ENV=production
4-
ENV NODE_ENV $NODE_ENV
3+
ENV NODE_ENV=production
54

65
RUN apk add --no-cache make caddy
76
RUN npm install -g @stoplight/prism-cli
@@ -10,7 +9,7 @@ COPY package.json package-lock.json* ./
109
RUN npm ci && npm cache clean --force
1110

1211
COPY . .
13-
RUN make compile
12+
# RUN make compile
1413

1514
EXPOSE 8080
1615

Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
IMAGE_ID := ghcr.io/hexlet-components/rest-api-example
2+
13
setup:
24
npm ci
35
make compile
@@ -9,21 +11,25 @@ compile:
911
npx tsp compile ./typespec/js-playwright/main.tsp --output-dir "./tsp-output/js-playwright"
1012

1113
dev:
12-
npx fastify start -a 0.0.0.0 server/src/index.js
14+
docker run -v ./custom-server:/custom-server -p 8080:8080 $(IMAGE_ID)
1315

1416
start:
1517
prism mock -m -p 4011 --host 0.0.0.0 ./tsp-output/http-api/@typespec/openapi3/openapi.1.0.yaml &
1618
prism mock -m -p 4012 --host 0.0.0.0 ./tsp-output/http-protocol/@typespec/openapi3/openapi.1.0.yaml &
1719
prism mock -m -p 4013 --host 0.0.0.0 ./tsp-output/js-playwright/@typespec/openapi3/openapi.1.0.yaml &
1820
prism mock -m -p 4014 --host 0.0.0.0 ./tsp-output/postman/@typespec/openapi3/openapi.1.0.yaml &
1921
npm start &
20-
caddy run &
22+
caddy run
2123

2224
test:
2325
echo no tests
2426

25-
compose-test:
26-
docker compose up --build --abort-on-container-exit
27+
docker-build:
28+
docker build . -t $(IMAGE_ID)
29+
30+
docker-run:
31+
docker rm -f rest-api-example
32+
docker run -p 8080:8080 --name rest-api-example $(IMAGE_ID)
2733

28-
generate-fixtures:
29-
node server/bin/generateFixtures.js
34+
docker-sh:
35+
docker run -it --entrypoint sh $(IMAGE_ID)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See [Makefile](./Makefile)
1313

1414
```bash
1515
make setup
16-
make start # Open http://localhost:5000/swagger
16+
make dev # Open http://localhost:8080
1717
```
1818

1919
---

app.config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
"version": "1.0",
55
"openapiFilePath": "tsp-output/@typespec/openapi3/openapi.1.0.yaml",
66
"docRoute": "openapi",
7-
"apiKey": "tybRrq0Te4tBtQAubh9Qs9qprLyTc2kbBn4laQFPzYxtWymhMZRt5gTQ8a3aBegrgW5FZoEcmijz8micMRFUglLJDAv2QtqSZwzaWugMlyfLvnsIAWhrLS8y"
7+
"apiKey": "tybRrq0Te4tBtQAubh9Qs9qprLyTc2kbBn4laQFPzYxtWymhMZRt5gTQ8a3aBegrgW5FZoEcmijz8micMRFUglLJDAv2QtqSZwzaWugMlyfLvnsIAWhrLS8y",
8+
"apps": [
9+
"http-api",
10+
"http-protocol",
11+
"js-playwright",
12+
"postman"
13+
]
814
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.63

custom-server/assets/docs/http-api/index.html

Lines changed: 12975 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)