Skip to content

Commit

Permalink
update backend port (#101)
Browse files Browse the repository at this point in the history
* update backend port

* increase jest timeout
  • Loading branch information
kchia authored May 19, 2022
1 parent d28d0b8 commit 78ffcf3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The table below describes the folders in this starter repository:

| Folder/file path | Description |
| ---------------- | ---------------------------------------------------------------- |
| `./back-end` | The backend project, which runs on `localhost:5000` by default. |
| `./back-end` | The backend project, which runs on `localhost:5001` by default. |
| `./front-end` | The frontend project, which runs on `localhost:3000` by default. |

This starter code closely follows the best practices and patterns established in the Robust Server Structure module.
Expand Down Expand Up @@ -87,7 +87,7 @@ Run `npx knex` commands from within the `back-end` folder, which is where the `k
1. Run `cp ./back-end/.env.sample ./back-end/.env`.
1. Update the `./back-end/.env` file with the connection URL's to your ElephantSQL database instance.
1. Run `cp ./front-end/.env.sample ./front-end/.env`.
1. You should not need to make changes to the `./front-end/.env` file unless you want to connect to a backend at a location other than `http://localhost:5000`.
1. You should not need to make changes to the `./front-end/.env` file unless you want to connect to a backend at a location other than `http://localhost:5001`.
1. Run `npm install` to install project dependencies.
1. Run `npm run start:dev` to start your server in development mode.

Expand Down
2 changes: 1 addition & 1 deletion back-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"start": "node src/server.js",
"start:dev": "nodemon src/server.js",
"test": "npx cross-env LOG_LEVEL=warn jest --runInBand --detectOpenHandles --forceExit",
"test": "npx cross-env LOG_LEVEL=warn jest --runInBand --detectOpenHandles --forceExit --config ./test/jest.config.js",
"test:1": "npm run test -- us-01",
"test:2": "npm run test -- us-02",
"test:3": "npm run test -- us-03",
Expand Down
2 changes: 1 addition & 1 deletion back-end/src/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { PORT = 5000 } = process.env;
const { PORT = 5001 } = process.env;

const app = require("./app");
const knex = require("./db/connection");
Expand Down
3 changes: 3 additions & 0 deletions back-end/test/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
testTimeout: 20000,
};
2 changes: 1 addition & 1 deletion front-end/.env.sample
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API_BASE_URL=http://localhost:5000
REACT_APP_API_BASE_URL=http://localhost:5001
2 changes: 1 addition & 1 deletion front-end/e2e/api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fetch = require("cross-fetch");

const API_BASE_URL =
process.env.REACT_APP_API_BASE_URL || "http://localhost:5000";
process.env.REACT_APP_API_BASE_URL || "http://localhost:5001";

/**
* Defines the default headers for these functions to work with `json-server`
Expand Down
2 changes: 1 addition & 1 deletion front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"test:7": "run-p -l -r test:start:* \"test:e2e:run -- us-07\"",
"test:8": "run-p -l -r test:start:* \"test:e2e:run -- us-08\"",
"test:e2e": "run-p -l -r test:start:* test:e2e:run",
"test:e2e:run": "wait-on http://localhost:5000/reservations?date=2020-01-01 && jest --detectOpenHandles --forceExit --config ./e2e/jest.config.js",
"test:e2e:run": "wait-on http://localhost:5001/reservations?date=2020-01-01 && jest --detectOpenHandles --forceExit --config ./e2e/jest.config.js",
"test:start:backend": "npm run test:start --prefix ./../back-end",
"test:start:frontend": "npx cross-env BROWSER=none NODE_ENV=test react-scripts start",
"test:unit": "react-scripts test"
Expand Down
2 changes: 1 addition & 1 deletion front-end/src/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import formatReservationDate from "./format-reservation-date";
import formatReservationTime from "./format-reservation-date";

const API_BASE_URL =
process.env.REACT_APP_API_BASE_URL || "http://localhost:5000";
process.env.REACT_APP_API_BASE_URL || "http://localhost:5001";

/**
* Defines the default headers for these functions to work with `json-server`
Expand Down

0 comments on commit 78ffcf3

Please sign in to comment.