Server for drone app
Have node installed.
Add additional packages:
npm install sqlite3 --save
Get an API key for forecast.io. Save the API key to the following file in the root directory:
weather_token.txt
(The DEBUG
option can be skipped and will default to false
.)
(Subsequent instruction assume accessing a server on localhost
running on port 8080
.)
Run:
PORT=8080 DEBUG={true|false} node server.js
Run:
set PORT=8080
set DEBUG={true|false}
node server.js
From a browser or other client, open (or otherwise run a GET request):
http://localhost:8080/drone/{drone_id}
{drone_id}
is the unique identifier for your drone.
Send a POST request to:
http://localhost:8080/drone?id={drone_id}&lat={latitude}&lng={longitude}