Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 61c460b

Browse files
committedApr 18, 2019
Add mock Scorecard API
1 parent 71f6437 commit 61c460b

File tree

6 files changed

+442
-0
lines changed

6 files changed

+442
-0
lines changed
 

‎mock-scorecard-api/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Scorecard mock API
2+
3+
## Dependencies
4+
5+
- nodejs https://nodejs.org/en/ (v10+)
6+
7+
8+
## Local setup
9+
10+
Run `npm i` to install the dependencies and `npm start` to start the mock API.
11+
And the app is running at `http://localhost:4000`.
12+
13+
14+
## Endpoints
15+
16+
- `/scoreSystems` - returns the score systems
17+
- `/scorecards/:id` - returns the details for a specific scorecard
18+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"id": "b9956051-4749-4912-abd1-af4d701af891",
4+
"name": "AV Scan",
5+
"phase": "submission",
6+
"isActive": true,
7+
"topic": "avscan.action.scan"
8+
},
9+
{
10+
"id": "b9956051-4749-4912-abd1-af4d701af892",
11+
"name": "OR",
12+
"phase": "review",
13+
"isActive": true,
14+
"topic": "or.action.review"
15+
},
16+
{
17+
"id": "b9956051-4749-4912-abd1-af4d701af893",
18+
"name": "AV Scan",
19+
"phase": "registration",
20+
"isActive": true,
21+
"topic": "avscan.action.scan"
22+
},
23+
{
24+
"id": "b9956051-4749-4912-abd1-af4d701af894",
25+
"name": "OR",
26+
"phase": "registration",
27+
"isActive": true,
28+
"topic": "or.action.review"
29+
}
30+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"id": "b9956051-4749-4912-abd5-bf4d701af891"
3+
}

‎mock-scorecard-api/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const express = require('express')
2+
const scoreSystems = require('./data/scoreSystems.json')
3+
const scorecardDetails = require('./data/scorecardDetails.json')
4+
const app = express()
5+
6+
scorecardDetails.scorecardDetails = []
7+
8+
scoreSystems.forEach(element => {
9+
scorecardDetails.scorecardDetails.push({
10+
...element,
11+
weight: 100 / scoreSystems.length
12+
})
13+
})
14+
15+
app.get('/scoreSystems', (req, res) => res.json(scoreSystems))
16+
app.get('/scorecards/:id', (req, res) => res.json(scorecardDetails))
17+
18+
app.listen(process.env.PORT || 4000);
19+
console.log(`Server listening on http://localhost:${process.env.PORT || 4000}`)

‎mock-scorecard-api/package-lock.json

Lines changed: 358 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎mock-scorecard-api/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "mock-scorecard-api",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "node index.js"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"express": "^4.16.4"
13+
}
14+
}

0 commit comments

Comments
 (0)
This repository has been archived.