Skip to content

Commit

Permalink
29 make the api mock server (#30)
Browse files Browse the repository at this point in the history
* feat: add docker setting files

* feat: add a script to run api mock server

* fix: remove detach option to be like other cmds

* doc: add Mock server section
  • Loading branch information
taniguchiiqqq authored Nov 15, 2023
1 parent 789f3f2 commit ec46ecf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM stoplight/prism:5

# get the latest OAS file from nishiki-document repo
RUN wget https://raw.githubusercontent.com/genesis-tech-tribe/nishiki-documents/c1ea7d5a2fd12e1271551fc672b7141f5777ffdf/web-api/nishiki-web-api.yaml \
&& mv nishiki-web-api.yaml /tmp/api.yml
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ You can start editing the page by modifying `app/page.tsx`. The page auto-update

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Run Mock Server

Run the WebAPI mock server:

```bash
npm run mock
```

## Learn More

To learn more about Next.js, take a look at the following resources:
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
prism:
build:
context: .
dockerfile: Dockerfile
command: 'mock -h 0.0.0.0 /tmp/api.yml'
ports:
# Serve the mocked API locally as available on port 8080
- '8080:4010'
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint:fix": "eslint --ext .ts,.js,.tsx . --fix && prettier --write \"./**/*.{ts,js,tsx,scss}\"",
"format": "prettier --write './**/*.{js,ts,tsx,scss}'",
"prepare": "husky install",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"mock": "docker compose up --build"
},
"dependencies": {
"next": "13.5.4",
Expand Down

0 comments on commit ec46ecf

Please sign in to comment.