File tree 4 files changed +67
-0
lines changed
4 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ # client-api
2
+
3
+ ## Task
4
+
5
+ Create a client API package, the can run on both browser and node
6
+
7
+ ### Requirements
8
+
9
+ 1 . The client should run on both browser and node - [ AJAX/HTTP Library Comparison] ( http://andrewhfarmer.com/ajax-libraries/ ) .
10
+ 2 . export function ``` search ``` for searching the API
11
+ ```
12
+ // params example - { query: 'str-to-search' }
13
+ search(params) {
14
+ // return promise
15
+ }
16
+ ```
17
+ 3 . export object ``` config ``` for configuring the API endpoint when not running on browser
18
+ ```
19
+ config = {
20
+ endpoint: '/api/' // default value
21
+ }
22
+ ```
Original file line number Diff line number Diff line change
1
+ # Discovery
2
+
3
+ This is a naive implementation of [ service discovery] ( https://en.wikipedia.org/wiki/Service_discovery ) ,
4
+ it is hard coded and has no actual discovering functionality.
5
+
6
+ The purpose of this mode is educational, all configurations in micro services environments
7
+ should be consume though external service.
8
+
9
+ ## Usage
10
+
11
+ Read the code it short and simple.
12
+
13
+ ```
14
+ const discovery = require('discovery')
15
+ const serviceName = 'service-api'
16
+ discovery[serviceName].host // service host
17
+ discovery[serviceName].port // service port
18
+ ```
Original file line number Diff line number Diff line change
1
+ # service-api
2
+
3
+ This is our micro service gateway, the only service exposed to the world.
4
+
5
+ ## Task
6
+
7
+ Create a server with one GET endpoint at ``` /api/search ``` that receives one url parameter ``` query ``` ,
8
+ the return response should be the scraper result for this query.
9
+
10
+
Original file line number Diff line number Diff line change
1
+ # service-scraper
2
+
3
+ ## Task
4
+
5
+ Create a server with one GET endpoint at ``` / ``` that receives one url parameter ``` query ``` ,
6
+ the return response should be the results of the search query on google play.
7
+
8
+ ### Requirements
9
+
10
+ 1 . Don't waste time use [ google-play-scraper] ( https://www.npmjs.com/package/google-play-scraper ) .
11
+ 2 . Cache result (in memory is ok).
12
+ 3 . return 404 when no query parameter or value.
13
+
14
+ ### Extra
15
+
16
+ - Persistency of the cached results.
17
+ - [ Tape] ( https://github.com/substack/tape ) tests.
You can’t perform that action at this time.
0 commit comments