@@ -51,8 +51,10 @@ cd json-server-docker
51
51
docker-compose up -d
52
52
```
53
53
54
- I highly recommend installing [ ` dotdocker ` ] ( https://github.com/aj-may/dotdocker ) first. The
55
- container will then be accessible at < http://json-server.docker > .
54
+ Visit < http://localhost:9999/ > to see your running JSON Server.
55
+
56
+ If you have [ ` dotdocker ` ] ( https://github.com/aj-may/dotdocker ) installed the server will also be
57
+ accessible at < http://json-server.docker > .
56
58
57
59
### Options
58
60
@@ -109,22 +111,22 @@ services:
109
111
## Database File
110
112
111
113
When building your mock api's you'll most like want to generate some fake data and return a number
112
- of items for a specific collection. I've included [Lodash ](https://lodash .com/) &
113
- [faker.js](https://github.com/Marak/faker.js) in the image to help facilitate doing these sorts of
114
- things inside your source file, or middleware for that matter. Here's an example of what I mean :
114
+ of items for a specific collection. [Faker ](https://github .com/faker-js/faker) is included in the
115
+ image to help facilitate doing these sorts of things inside your db or middleware files. For
116
+ example:
115
117
116
118
` ` ` js
117
- const faker = require('faker');
118
- const times = require('lodash/times');
119
- const startCase = require('lodash/startCase');
119
+ const faker = require('@faker-js/faker');
120
120
121
121
module.exports = () => ({
122
- posts : times(100, index => ({
123
- id : index,
124
- title : startCase(faker.lorem.words(3)),
125
- body : faker.lorem.paragraphs(3),
126
- // and so on...
127
- })),
122
+ posts : faker.helpers.multiple(
123
+ () => ({
124
+ id : faker.datatype.uuid(),
125
+ title : faker.lorem.words(3),
126
+ body : faker.lorem.paragraphs(3),
127
+ }),
128
+ { count: 100 },
129
+ ),
128
130
});
129
131
```
130
132
@@ -159,9 +161,3 @@ feature change with our implementation but the `json-server` version doesn't cha
159
161
``` sh
160
162
git tag -fa v0.16.1 -m " Update v0.16.1 tag" && git push origin v0.16.1 --force
161
163
```
162
-
163
- Docker Hub is configured to automatically build on new tags pushed to GitHub.
164
-
165
- ## Todo
166
-
167
- - Add examples of using this with docker cli, without a compose file
0 commit comments