Finds the best link station (nearest / with strongest signal) for a given mobile device location in 2D space.
The project may run in two modes:
To run as a web server the project may be executed using npm start
.
The server support the following API, which is usually REST that returns a JSON object:
/demo
Output the results of a predefined set of device coordinates./ls
Output the list of link stations that the app is familiar with/device/x/y
Find the best link station for a given device's location
For example:/device/5/7
/
(the website's root)
A demo page, containing examples for the various API calls.
This CLI app is executed using node app.js
and may be operated in several modes:
-
Demo mode
Output the results of a predefined set of device coordinates.
Syntax:node app.js demo
-
Device location mode
Find the best link station for a given device's location
Syntax:node app.js --x=<number> --y=<number>
-
List link stations
Output the list of link stations that the app is familiar with
Syntax:node app.js ls
You may run node app.js --help
for details about the app's various commands and flags.
See data/README.md for details
The project utilizes the yargs
package in order to parse command line arguments.
In case of an error, an error message will be printed.
The -d
/ --debug
flag may be used in order to get extended debug info.
Error handling will take care of invalid input, such as non-numeric values where a float is expected, for example.
Any unexpected error will be trapped by a global 'uncaught exception' handler.
The project utilizes the jest
library for unit testing all major source code files.
The tests suite may be run using: npm test
Follow these steps to deploy the project:
- Clone this git repository
- Change dir into the project's root directory
- Run
npm install
- Run
npm test
You may now run the application according to the Description and Usage section above.