Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wakuwaku3 committed Oct 9, 2018
2 parents 6c19ba0 + 03d63bf commit b6623b2
Show file tree
Hide file tree
Showing 46 changed files with 557 additions and 154 deletions.
6 changes: 3 additions & 3 deletions .env
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"
9 changes: 9 additions & 0 deletions .mock/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"authenticate-refresh": {
"token": "token"
},
"authenticate-sign-in": {
"errors": [],
"token": "token"
}
}
32 changes: 32 additions & 0 deletions .mock/server.js
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');
});
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"clickaway",
"csstype",
"haspopup",
"inversify",
"localstorage",
"middlewares",
"roboto",
"selectable",
"tmpps"
Expand Down
Loading

0 comments on commit b6623b2

Please sign in to comment.