Skip to content

Commit f410a6f

Browse files
Merge pull request #3 from shubhankar30/master
Removed bugs | Readme fix | Input debug logs for easier debugging
2 parents e48c9fd + 786e233 commit f410a6f

File tree

6 files changed

+1035
-735
lines changed

6 files changed

+1035
-735
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
# JSONServer + JWT Auth
22

3-
A Fake REST API using json-server with JWT authentication. You can find the [complete tutorial here](https://www.techiediaries.com/fake-api-jwt-json-server/)
3+
A Fake REST API using json-server with JWT authentication.
4+
5+
Implemented End-points: login,register
46

57
## Install
68

79
```bash
810
$ npm install
9-
$ npm run api-auth
11+
$ npm run start-auth
12+
```
13+
14+
Might need to run
15+
```
16+
npm audit fix
1017
```
1118

12-
## How to login?
19+
## How to login/register?
1320

14-
You can login by sending a POST request to
21+
You can login/register by sending a POST request to
1522

1623
```
17-
POST http://localhost:3000/auth/login
24+
POST http://localhost:8000/auth/login
25+
POST http://localhost:8000/auth/register
1826
```
1927
with the following data
2028

database.json

Lines changed: 69 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,79 @@
33
{
44
"id": 1,
55
"name": "Product001",
6-
"cost": 10.0,
6+
"cost": 10,
77
"quantity": 1000,
8-
"locationId" : 1,
9-
"familyId" : 1
8+
"locationId": 1,
9+
"familyId": 1
1010
},
1111
{
1212
"id": 2,
1313
"name": "Product002",
14-
"cost": 20.0,
14+
"cost": 20,
1515
"quantity": 2000,
16-
"locationId" : 1,
17-
"familyId" : 2
18-
},
16+
"locationId": 1,
17+
"familyId": 2
18+
},
1919
{
2020
"id": 3,
2121
"name": "Product003",
22-
"cost": 30.0,
22+
"cost": 30,
2323
"quantity": 3000,
24-
"locationId" : 3,
25-
"familyId" : 2
24+
"locationId": 3,
25+
"familyId": 2
2626
},
2727
{
2828
"id": 4,
2929
"name": "Product004",
30-
"cost": 40.0,
30+
"cost": 40,
3131
"quantity": 4000,
32-
"locationId" : 2,
33-
"familyId" : 3
32+
"locationId": 2,
33+
"familyId": 3
34+
},
35+
{
36+
"id": 5
37+
},
38+
{
39+
"id": 6
40+
},
41+
{
42+
"id": 7
43+
},
44+
{
45+
"id": 8
46+
},
47+
{
48+
"id": 9
49+
},
50+
{
51+
"id": 10
52+
},
53+
{
54+
"id": 11
55+
},
56+
{
57+
"id": 12
58+
},
59+
{
60+
"id": 13
61+
},
62+
{
63+
"id": 14
64+
},
65+
{
66+
"id": 15
67+
},
68+
{
69+
"id": 16
70+
},
71+
{
72+
"id": 17
73+
},
74+
{
75+
"id": 18
3476
}
3577
],
36-
"locations":[
78+
"locations": [
3779
{
3880
"id": 1,
3981
"name": "Location001"
@@ -47,7 +89,7 @@
4789
"name": "Location003"
4890
}
4991
],
50-
"families":[
92+
"families": [
5193
{
5294
"id": 1,
5395
"name": "FM001"
@@ -61,24 +103,24 @@
61103
"name": "FM003"
62104
}
63105
],
64-
"transactions":[
106+
"transactions": [
65107
{
66108
"id": 1,
67-
"cost":11,
68-
"quantity":10,
69-
"productId":1
109+
"cost": 11,
110+
"quantity": 10,
111+
"productId": 1
70112
},
71113
{
72114
"id": 2,
73-
"cost":12,
74-
"quantity":100,
75-
"productId":2
76-
},
115+
"cost": 12,
116+
"quantity": 100,
117+
"productId": 2
118+
},
77119
{
78120
"id": 3,
79-
"cost":15,
80-
"quantity":101,
81-
"productId":3
82-
}
121+
"cost": 15,
122+
"quantity": 101,
123+
"productId": 3
124+
}
83125
]
84126
}

0 commit comments

Comments
 (0)