This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +150
-0
lines changed Expand file tree Collapse file tree 3 files changed +150
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Topcoder Leaderboard API
2
+
3
+ ## Dependencies
4
+
5
+ - nodejs https://nodejs.org/en/ (v10)
6
+ - Kafka (v2)
7
+ - Mongodb (v4)
8
+
9
+ ## Configuration
10
+
11
+ Configuration for the application is at ` config/default.js ` .
12
+ The following parameters can be set in config files or in env variables:
13
+
14
+ - LOG_LEVEL: the log level
15
+ - PORT: the server port
16
+ - MONGODB_URL: Mongo DB URL
17
+
18
+ ## Local deployment
19
+
20
+ - From the project root directory, run the following command to install the dependencies
21
+
22
+ ``` bash
23
+ npm i
24
+ ```
25
+
26
+ - To run linters if required
27
+
28
+ ``` bash
29
+ npm run lint
30
+
31
+ npm run lint:fix # To fix possible lint errors
32
+ ```
33
+
34
+ - Start the express server
35
+
36
+ ``` bash
37
+ npm start
38
+ ```
39
+
40
+ ## Heroku Deployment
41
+
42
+ - git init
43
+ - git add .
44
+ - git commit -m init
45
+ - heroku create
46
+ - heroku config: set MONGODB_URL=...
47
+ - git push heroku master
48
+
49
+ ## Verification
50
+
51
+ - Import the collection and environment into your POSTMAN app and check out the endpoints
Original file line number Diff line number Diff line change
1
+ {
2
+ "info" : {
3
+ "_postman_id" : " 6ded693a-4eab-49d0-ac45-49621336658e" ,
4
+ "name" : " Leaderboard API" ,
5
+ "schema" : " https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
6
+ },
7
+ "item" : [
8
+ {
9
+ "name" : " Get leaderboard with challengeId" ,
10
+ "request" : {
11
+ "method" : " GET" ,
12
+ "header" : [],
13
+ "body" : {},
14
+ "url" : {
15
+ "raw" : " {{URL}}/leaderboard?challengeId=30051825" ,
16
+ "host" : [
17
+ " {{URL}}"
18
+ ],
19
+ "path" : [
20
+ " leaderboard"
21
+ ],
22
+ "query" : [
23
+ {
24
+ "key" : " challengeId" ,
25
+ "value" : " 30051825"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ "response" : []
31
+ },
32
+ {
33
+ "name" : " Get leaderboard with skip and limit" ,
34
+ "request" : {
35
+ "method" : " GET" ,
36
+ "header" : [],
37
+ "body" : {},
38
+ "url" : {
39
+ "raw" : " {{URL}}/leaderboard?challengeId=30051825&skip=1&limit=2" ,
40
+ "host" : [
41
+ " {{URL}}"
42
+ ],
43
+ "path" : [
44
+ " leaderboard"
45
+ ],
46
+ "query" : [
47
+ {
48
+ "key" : " challengeId" ,
49
+ "value" : " 30051825"
50
+ },
51
+ {
52
+ "key" : " skip" ,
53
+ "value" : " 1"
54
+ },
55
+ {
56
+ "key" : " limit" ,
57
+ "value" : " 2"
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ "response" : []
63
+ },
64
+ {
65
+ "name" : " Get leaderboard without challengeId" ,
66
+ "request" : {
67
+ "method" : " GET" ,
68
+ "header" : [],
69
+ "body" : {},
70
+ "url" : {
71
+ "raw" : " {{URL}}/leaderboard" ,
72
+ "host" : [
73
+ " {{URL}}"
74
+ ],
75
+ "path" : [
76
+ " leaderboard"
77
+ ]
78
+ }
79
+ },
80
+ "response" : []
81
+ }
82
+ ]
83
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "id" : " 550a699a-87d8-4799-99a2-b9f22980f415" ,
3
+ "name" : " leaderboard-api" ,
4
+ "values" : [
5
+ {
6
+ "key" : " URL" ,
7
+ "value" : " http://localhost:3000" ,
8
+ "description" : " " ,
9
+ "type" : " text" ,
10
+ "enabled" : true
11
+ }
12
+ ],
13
+ "_postman_variable_scope" : " environment" ,
14
+ "_postman_exported_at" : " 2018-10-15T07:56:51.910Z" ,
15
+ "_postman_exported_using" : " Postman/6.1.3"
16
+ }
You can’t perform that action at this time.
0 commit comments