Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/romaleev/nodejs-queue-service
Node.js API queueing service
https://github.com/romaleev/nodejs-queue-service
api babel node nodejs nodemon queue
Last synced: about 1 month ago
JSON representation
Node.js API queueing service
- Host: GitHub
- URL: https://github.com/romaleev/nodejs-queue-service
- Owner: romaleev
- Created: 2016-10-30T15:08:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T06:18:44.000Z (about 2 years ago)
- Last Synced: 2024-05-10T03:45:47.783Z (8 months ago)
- Topics: api, babel, node, nodejs, nodemon, queue
- Language: TypeScript
- Size: 169 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js API queuing service
There are 3 different APIs the service has to interface with:
1. Shipments API [GET]
Accepts a query with 9-digit order numbers and returns a set of products (envelope, box or pallet) equivalent to the last digit.
2. Track API [GET]
Accepts a query with 9-digit consignment number and returns one of the following tracking statuses: NEW, IN TRANSIT, COLLECTING, COLLECTED, DELIVERING, DELIVERED.
3. Pricing API [GET]
Accepts a query with ISO-2 country code and returns a randomized floating number between 1 and 100.There are 2 services:
1. Query service [POST]:
- Exposes a method that accepts a collection of API requests {'API': 'query'}.
- Makes calls to corresponding APIs.
- Returns a complete set of responses upon receiving all API responses.
2. Queue query service [POST]:
- Exposes a method that accepts a collection of API requests {'API': 'query'}.
- API calls should be throttled and bulked into 1 request per respective API.
- Makes a queue of calls with threshold of maximum 5 concurrent requests per API endpoint.
- Returns a complete set of responses upon receiving all corresponding API responses.Author: Roman Malieiev
Project consists of two builds:
- production optimised
- development with source change watchersTech stack:
- Node.js
- Babel for ES6 support with ESLint
- Nodemon development build
- Frisby tests## Installation
1. Install Node.js/npm
2. Navigate to the current folder
3. Run:`npm install`
## Running
Run in development mode:
npm start
Build for production:
npm run build
Following urls would be available:
- http://localhost:8080/shipments [GET] - Shipments API
- http://localhost:8080/track [GET] - Track API
- http://localhost:8080/pricing [GET] - Pricing API
- http://localhost:8080/service [POST] - Query service
- http://localhost:8080/service-queue [POST] - Queue query service**NOTE**: see tests for requests examples.
Test:
npm start
npm test## Questions
#### With the above solution, can you imagine a scenario where unnecessary calls to either one of the APIs will happen? If so, how could you solve this?
We can implement caching within some time