Skip to content

Commit

Permalink
#1 [setup] add package json-server and fake server api
Browse files Browse the repository at this point in the history
  • Loading branch information
blackjack-ttp committed Oct 1, 2023
1 parent c8100b5 commit 2b3be48
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"prepare": "chmod +x .husky/pre-commit && chmod +x .husky/commit-msg && husky install",
"pre-commit": "echo \"[Husky] pre-commit\""
"pre-commit": "echo \"[Husky] pre-commit\"",
"server": "json-server --watch ./database/db.json --routes ./database/routes.json --port 5000"
},
"husky": {
"hooks": {
Expand Down
59 changes: 59 additions & 0 deletions src/database/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"todos": [
{
"title": "Nguyễn Tiến Tài",
"completed": false,
"id": 1
},
{
"title": "Nguyễn Võ Tiền",
"completed": false,
"id": 2
},
{
"title": "Lê Ngọc Trâm Anh",
"completed": false,
"id": 3
},
{
"title": "Nguyễn Quốc Hào",
"completed": false,
"id": 4
},
{
"title": "Nguyễn Thanh Phong",
"completed": false,
"id": 5
},
{
"title": "Trương Tấn Ngĩa",
"completed": false,
"id": 6
},
{
"title": "Tấn Nguyễn",
"completed": false,
"id": 7
},
{
"title": "Hải Nam",
"completed": false,
"id": 8
},
{
"title": "Nguyễn Văn C",
"completed": true,
"id": 11
},
{
"title": "Nguyễn Văn D",
"completed": true,
"id": 12
},
{
"title": "Nguyên Văn A",
"completed": true,
"id": 13
}
]
}
4 changes: 4 additions & 0 deletions src/database/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"/api/*": "/$1",
"/todos": "/todos"
}

0 comments on commit 2b3be48

Please sign in to comment.