-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
557 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# development | ||
REACT_APP_DEV_MOCK_MODE="1" | ||
REACT_APP_DEV_API_URL="http://localhost:5000/" | ||
REACT_APP_DEV_API_URL="" | ||
# test | ||
REACT_APP_TEST_MOCK_MODE="1" | ||
REACT_APP_TEST_MOCK_MODE="0" | ||
REACT_APP_TEST_API_URL="" | ||
# production | ||
REACT_APP_PROD_MOCK_MODE="0" | ||
REACT_APP_PROD_API_URL="http://localhost:5000/" | ||
REACT_APP_PROD_API_URL="http://localhost:5000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"authenticate-refresh": { | ||
"token": "token" | ||
}, | ||
"authenticate-sign-in": { | ||
"errors": [], | ||
"token": "token" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const jsonServer = require('json-server'); | ||
const server = jsonServer.create(); | ||
const router = jsonServer.router('.mock/db.json'); | ||
const middlewares = jsonServer.defaults(); | ||
|
||
// routes.jsonの内容をここに記載 | ||
server.use( | ||
jsonServer.rewriter({ | ||
'/authenticate/refresh': '/authenticate-refresh', | ||
'/authenticate/sign-in': '/authenticate-sign-in', | ||
}), | ||
); | ||
|
||
// ミドルウェアの設定 (コンソール出力するロガーやキャッシュの設定など) | ||
server.use(middlewares); | ||
|
||
server.use(function(req, res, next) { | ||
if (req.method === 'POST') { | ||
// POST送信を受ける場合、受けたPOST レスポンスをGETに変更する | ||
req.method = 'GET'; | ||
// req.query = req.body; | ||
} | ||
// Continue to JSON Server router | ||
next(); | ||
}); | ||
|
||
// db.json を基にデフォルトのルーティングを設定する | ||
server.use(router); | ||
// サーバをポート 3001 で起動する | ||
server.listen(3001, () => { | ||
console.log('JSON Server is running'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.