Skip to content

Commit

Permalink
Merge pull request #1297 from sharetribe/dev-api-server
Browse files Browse the repository at this point in the history
Dev API server
  • Loading branch information
kpuputti authored Jun 1, 2020
2 parents a769f48 + b9422ef commit f3c65c1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ way to update this template, but currently, we follow a pattern:
[#1291](https://github.com/sharetribe/ftw-daily/pull/1291)
- [change] Refactor server API routes into separate files.
[#1294](https://github.com/sharetribe/ftw-daily/pull/1294)
- [change] Start the backend API router in dev mode with a dev server.
[#1297](https://github.com/sharetribe/ftw-daily/pull/1297)

## [v4.4.3] 2020-05-13

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"babel-jest": "24.9.0",
"bfj": "^7.0.2",
"chalk": "^2.4.1",
"concurrently": "^5.2.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.12.0",
"enzyme-to-json": "^3.4.4",
Expand All @@ -84,7 +85,10 @@
"audit": "yarn audit --json | node scripts/audit.js",
"clean": "rm -rf build/*",
"config": "node scripts/config.js",
"dev": "node scripts/config.js --check && sharetribe-scripts start",
"config-check": "node scripts/config.js --check",
"dev-frontend": "sharetribe-scripts start",
"dev-backend": "DEV_API_SERVER_PORT=3500 nodemon server/apiServer.js",
"dev": "yarn run config-check&&concurrently --kill-others \"yarn run dev-frontend\" \"yarn run dev-backend\"",
"build": "sharetribe-scripts build",
"format": "prettier --write '**/*.{js,css}'",
"format-ci": "prettier --list-different '**/*.{js,css}'",
Expand Down
20 changes: 20 additions & 0 deletions server/apiServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// NOTE: this server is purely a dev-mode server. In production, the
// server/index.js server also serves the API routes.

// Configure process.env with .env.* files
require('./env').configureEnv();

const express = require('express');
const cookieParser = require('cookie-parser');
const apiRouter = require('./apiRouter');

const radix = 10;
const PORT = parseInt(process.env.DEV_API_SERVER_PORT, radix);
const app = express();
app.use(cookieParser());

app.use('/api', apiRouter);

app.listen(PORT, () => {
console.log(`API server listening on ${PORT}`);
});
46 changes: 46 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2903,6 +2903,21 @@ concat-stream@^1.5.0:
readable-stream "^2.2.2"
typedarray "^0.0.6"

concurrently@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-5.2.0.tgz#ead55121d08a0fc817085584c123cedec2e08975"
integrity sha512-XxcDbQ4/43d6CxR7+iV8IZXhur4KbmEJk1CetVMUqCy34z9l0DkszbY+/9wvmSnToTej0SYomc2WSRH+L0zVJw==
dependencies:
chalk "^2.4.2"
date-fns "^2.0.1"
lodash "^4.17.15"
read-pkg "^4.0.1"
rxjs "^6.5.2"
spawn-command "^0.0.2-1"
supports-color "^6.1.0"
tree-kill "^1.2.2"
yargs "^13.3.0"

configstore@^3.0.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f"
Expand Down Expand Up @@ -3415,6 +3430,11 @@ date-fns@^2.0.0:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.1.tgz#c5f30e31d3294918e6b6a82753a4e719120e203d"
integrity sha512-C14oTzTZy8DH1Eq8N78owrCWvf3+cnJw88BTK/N3DYWVxDJuJzPaNdplzYxDYuuXXGvqBcO4Vy5SOrwAooXSWw==

date-fns@^2.0.1:
version "2.14.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.14.0.tgz#359a87a265bb34ef2e38f93ecf63ac453f9bc7ba"
integrity sha512-1zD+68jhFgDIM0rF05rcwYO8cExdNqxjq4xP1QKM60Q45mnO6zaMWB4tOzrIr4M4GSLntsKeE4c9Bdl2jhL/yw==

date-now@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
Expand Down Expand Up @@ -9519,6 +9539,15 @@ read-pkg@^3.0.0:
normalize-package-data "^2.3.2"
path-type "^3.0.0"

read-pkg@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"
integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc=
dependencies:
normalize-package-data "^2.3.2"
parse-json "^4.0.0"
pify "^3.0.0"

"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
Expand Down Expand Up @@ -9949,6 +9978,13 @@ rxjs@^6.4.0:
dependencies:
tslib "^1.9.0"

rxjs@^6.5.2:
version "6.5.5"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec"
integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==
dependencies:
tslib "^1.9.0"

[email protected], safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down Expand Up @@ -10425,6 +10461,11 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=

spawn-command@^0.0.2-1:
version "0.0.2-1"
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
integrity sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=

spdx-correct@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
Expand Down Expand Up @@ -11027,6 +11068,11 @@ transit-js@^0.8.861:
resolved "https://registry.yarnpkg.com/transit-js/-/transit-js-0.8.861.tgz#829e516b80349a41fff5d59f5e6993b5473f72c9"
integrity sha512-4O9OrYPZw6C0M5gMTvaeOp+xYz6EF79JsyxIvqXHlt+pisSrioJWFOE80N8aCPoJLcNaXF442RZrVtdmd4wkDQ==

tree-kill@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==

trim-newlines@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20"
Expand Down

0 comments on commit f3c65c1

Please sign in to comment.