File tree Expand file tree Collapse file tree 5 files changed +1315
-74
lines changed Expand file tree Collapse file tree 5 files changed +1315
-74
lines changed Original file line number Diff line number Diff line change 1
1
# Logs
2
2
logs
3
3
* .log
4
- npm-debug.log *
5
- yarn-debug.log *
6
- yarn-error.log *
7
- lerna-debug.log *
8
4
9
5
# Diagnostic reports (https://nodejs.org/api/report.html)
10
6
report. [0-9 ]* . [0-9 ]* . [0-9 ]* . [0-9 ]* .json
11
7
12
- # Runtime data
13
- pids
14
- * .pid
15
- * .seed
16
- * .pid.lock
17
-
18
- # Directory for instrumented libs generated by jscoverage/JSCover
19
- lib-cov
20
-
21
- # Coverage directory used by tools like istanbul
22
- coverage
23
- * .lcov
24
-
25
- # nyc test coverage
26
- .nyc_output
27
-
28
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29
- .grunt
30
-
31
- # Bower dependency directory (https://bower.io/)
32
- bower_components
33
-
34
- # node-waf configuration
35
- .lock-wscript
36
-
37
8
# Compiled binary addons (https://nodejs.org/api/addons.html)
38
9
build /Release
39
10
40
11
# Dependency directories
41
12
node_modules /
42
- jspm_packages /
43
13
44
14
# TypeScript v1 declaration files
45
15
typings /
@@ -53,52 +23,9 @@ typings/
53
23
# Optional eslint cache
54
24
.eslintcache
55
25
56
- # Microbundle cache
57
- .rpt2_cache /
58
- .rts2_cache_cjs /
59
- .rts2_cache_es /
60
- .rts2_cache_umd /
61
-
62
- # Optional REPL history
63
- .node_repl_history
64
-
65
- # Output of 'npm pack'
66
- * .tgz
67
-
68
26
# Yarn Integrity file
69
27
.yarn-integrity
70
28
71
29
# dotenv environment variables file
72
30
.env
73
31
.env.test
74
-
75
- # parcel-bundler cache (https://parceljs.org/)
76
- .cache
77
-
78
- # Next.js build output
79
- .next
80
-
81
- # Nuxt.js build / generate output
82
- .nuxt
83
- dist
84
-
85
- # Gatsby files
86
- .cache /
87
- # Comment in the public line in if your project uses Gatsby and *not* Next.js
88
- # https://nextjs.org/blog/next-9-1#public-directory-support
89
- # public
90
-
91
- # vuepress build output
92
- .vuepress /dist
93
-
94
- # Serverless directories
95
- .serverless /
96
-
97
- # FuseBox cache
98
- .fusebox /
99
-
100
- # DynamoDB Local files
101
- .dynamodb /
102
-
103
- # TernJS port file
104
- .tern-port
Original file line number Diff line number Diff line change 1
1
# mock-websocket-json-server
2
- A combination of json and WebSocket capable server, ideal for frontend development.
2
+ A json and WebSocket capable server, ideal for frontend development.
3
+
4
+ This is a base mock-server setup. Taking advantage of the fact that json-server is based on express,
5
+ it is combined with the _ ws_ package to provide realtime capabilities while mocking.
6
+
7
+ This implementation utilizes:
8
+ 1 . [ Express] ( https://github.com/expressjs/expressjs.com )
9
+ 2 . [ json-server] ( https://github.com/typicode/json-server )
10
+ 3 . [ ws] ( https://github.com/websockets/ws )
11
+
12
+ Start the simple json-server with ` yarn serve ` .
13
+ Run ` curl http://localhost:3000/transactions ` on a separate terminal to retrieve all transaction records.
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " mock-websocket-json-server" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Base mock server with REST and WebSocket support." ,
5
+ "main" : " index.js" ,
6
+ "repository" : " https://github.com/Gr3at/mock-websocket-json-server.git" ,
7
+ "author" : " Gr3at <33185243+Gr3at@users.noreply.github.com>" ,
8
+ "license" : " MIT" ,
9
+ "scripts" : {
10
+ "serve:json" : " json-server --watch src/json-server-db.json"
11
+ },
12
+ "dependencies" : {
13
+ "json-server" : " ^0.17.0" ,
14
+ "ws" : " ^8.8.0"
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "transactions" : [
3
+ {
4
+ "uuid" : " 95e45059-cbad-4e6e-8613-df499b4bd217" ,
5
+ "datetime" : " 2022-06-26T08:00:00Z" ,
6
+ "itemBidPrice" : 21.6 ,
7
+ "requestedQuantity" : 50 ,
8
+ "boughtQuantity" : 50 ,
9
+ "itemAgreedPrice" : 22.0 ,
10
+ "priceUnit" : " €"
11
+ },
12
+ {
13
+ "uuid" : " 235ac1d7-fbaa-4b3c-ac2b-c7c8f5402471" ,
14
+ "datetime" : " 2022-06-26T09:00:00Z" ,
15
+ "itemBidPrice" : 3.5 ,
16
+ "requestedQuantity" : 200 ,
17
+ "boughtQuantity" : 190 ,
18
+ "itemAgreedPrice" : 3.5 ,
19
+ "priceUnit" : " €"
20
+ },
21
+ {
22
+ "uuid" : " 3a5735e1-9f25-44c5-bb2c-0374883ed586" ,
23
+ "datetime" : " 2022-06-26T10:00:00Z" ,
24
+ "itemBidPrice" : 5.2 ,
25
+ "requestedQuantity" : 88 ,
26
+ "boughtQuantity" : 80 ,
27
+ "itemAgreedPrice" : 5.2 ,
28
+ "priceUnit" : " €"
29
+ }
30
+ ]
31
+ }
You can’t perform that action at this time.
0 commit comments