Backend project:
- Build a backend API service that returns the live information of satellites. An example of this API response is https://api.spacexdata.com/v4/starlink (we are recreating this API endpoint)
- Create a database with the appropriate schema. You can use any database of choice. To keep things simple, you can use Sqlite3
- Bonus: create an API endpoint that allows search by satellite name
- Bonus: create an API that takes as input parameters a (latitude l1, longitude l2, distance d) and returns all satellites that are within a maximum distance d from (l1, l2)
starlink-imagine-api.herokuapp.com/satellite/all
: returns all available satellite data (might return empty if an automatic refresh is being executed --> This could be corrected doing individual updates on an authenticated endpoint through MongoDB'sfindAndUpdate
method, instead of just deleting everything and creating it again).starlink-imagine-api.herokuapp.com/satellite?name=<choose a name>&limit=<choose how many results>
: search satellites by name. The limit field is optionalstarlink-imagine-api.herokuapp.com/satellite/within?l1=<latitude>&l2=<longitude>&d=<distance in kilometers>
: returns all satellites that are within a maximum distance d from (l1, l2)
This repository was developed with NodeJs v17.4.0 --- So keep that in mind if you have a different version.
- Clone this repository.
- You will need a mongo db instance. You can use a free instance in the cloud (thanks to MongoDB Atlas).
- Once you have created your MongoDB Atlas database: Add your IP address to the list of allowed connections, create your DB user and copy your connection URI.
- Create a
.env
file at the root directory of the repository - Add the line
MONGO_URI=<paste your MONGO URI here>
(you should complete it with your password) - Run the command
npm install
- Run the command
npm start
You should be able to use this repository