Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 1d65f44

Browse files
committed
Minor changes
- A note on running the App against the prod backend locally has been added into README.md. - Env config (holds API URL to use) is now passed into the React Component responsible for new challenge listings, as `config` prop.
1 parent 43fa2c3 commit 1d65f44

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ In order to test a logged in user, you must make an entry in your `/etc/hosts` f
2020
- To create the build: `npm run build`
2121
- To run code linting: `npm run lint`
2222
- To run the tests: `npm test`
23+
24+
## Running against Production backend
25+
To run this App against the production backend, you should configure your system in a way that a call to `local.topcoder.com` redirects to `localhost:3000` where the App is running. Then you just `npm run start-prod`, go to `local.topcoder.com` and use your credentials for the production web site (and, sure, be careful with what you are doing, it all will go through the production TopCoder API).
26+
27+
To make the mentioned configuration on Ubuntu 16.04 you:
28+
- Add `127.0.0.1 local.topcoder.com` to your `/etc/hosts`
29+
- `$ sudo apt install libcap2-bin`
30+
- `$ which node` to figure out your `path/to/node`
31+
- `$ sudo setcap cap_net_bind_service=+ep /path/to/node`
32+
- Now run the App.
33+
34+
*Disclaimer: I have no idea, what setcap does here, and how safe it is, but it does the job. Feel free to add your comments / modify this section, if you know more about it. Also, if you know how to make such configuration on other OS, please add it here.*
2335

2436
## Test Users
2537
- general member user accounts:

app/listings/listings.controller.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ import { loadUser } from '../services/userv3.service.js'
7575
vm.myChallenges = userChallenges.reverse().slice(0, 8)
7676

7777
// update myChallenges
78-
$scope.userProps = { isAuth: true, myChallenges: vm.myChallenges }
78+
$scope.userProps = {
79+
config: CONSTANTS,
80+
isAuth: true,
81+
myChallenges: vm.myChallenges
82+
}
7983

8084
vm.userHasChallenges = true
8185
vm.loading = false

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"build": "webpack --bail --progress --build --tc",
66
"start": "webpack-dev-server --history-api-fallback --host 0.0.0.0 --dev --tc --inline --progress --port 3000",
7+
"start-prod": "webpack-dev-server --history-api-fallback --host local.topcoder.com --prod --tc --inline --progress --port 80",
78
"lint": "eslint .",
89
"test": "karma start --tc --test"
910
},

0 commit comments

Comments
 (0)