Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f2b4486

Browse files
author
Rankvet-Developer
committedSep 11, 2022
server added
1 parent b593d3a commit f2b4486

File tree

6 files changed

+3528
-1
lines changed

6 files changed

+3528
-1
lines changed
 

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# dependencies
44
/node_modules
5-
/server
5+
/server/node_modules
66
/html_template
77
/.pnp
88
.pnp.js

‎server/README.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# lws-json-server-todos
2+
3+
Example in memory todos api with json-server by Learn with Sumit
4+
5+
# Installation
6+
7+
```bash
8+
git clone git@github.com:learnwithsumit/lws-json-server-todos.git
9+
cd lws-json-server-todos
10+
npm install json-server
11+
npm start
12+
```
13+
14+
Now opens:
15+
16+
- http://localhost:3000
17+
18+
You now have a full REST API. Test with POSTMAN or any other REST Client):
19+
20+
Retrieve all (GET):
21+
22+
```bash
23+
GET http://localhost:3000/todos
24+
```
25+
26+
Retrieve one (GET):
27+
28+
```bash
29+
GET http://localhost:3000/todos/1
30+
```
31+
32+
Post a todo (POST):
33+
34+
```bash
35+
POST http://localhost:3000/todos text="Learn Redux" completed=false color="red"
36+
```
37+
38+
Update todo (PUT):
39+
40+
```bash
41+
PUT http://localhost:3000/todos/3 name="Learn Redux with Learn with Sumit" completed=true color="green"
42+
```
43+
44+
Delete todo (DELETE):
45+
46+
```bash
47+
DELETE http://localhost:3000/todos/1
48+
```
49+
50+
51+
# Links
52+
53+
- https://github.com/typicode/json-server
54+
- Jswon view Chrome plugin: https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc
55+
- Learn with Sumit official website: htts://learnwithsumit.com

‎server/db_todos.json‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"todos": [
3+
{
4+
"id": 1,
5+
"text": "Learn Vanilla Javascript",
6+
"completed": true,
7+
"color": "yellow"
8+
},
9+
{
10+
"id": 2,
11+
"text": "Learn Modern ES6+ JavaScript",
12+
"completed": true,
13+
"color": "red"
14+
},
15+
{
16+
"id": 3,
17+
"text": "Learn React JS",
18+
"completed": true,
19+
"color": "yellow"
20+
},
21+
{
22+
"text": "Learn Redux Basics",
23+
"completed": true,
24+
"id": 4,
25+
"color": "red"
26+
},
27+
{
28+
"text": "Learn Redux fundamentals",
29+
"completed": false,
30+
"id": 5,
31+
"color": "red"
32+
},
33+
{
34+
"text": "learn Redux",
35+
"completed": false,
36+
"id": 6,
37+
"color": "green"
38+
},
39+
{
40+
"text": "Learn Redux Toolkit",
41+
"completed": false,
42+
"id": 7
43+
}
44+
]
45+
}

0 commit comments

Comments
 (0)
Please sign in to comment.