- Node 6.2.2
From within the root directory:
Install all npm dependencies.
$ npm install
Touch .env file and add TEST_API=YOUR_API_URL
$ touch .env
$ echo 'TEST_API=YOUR_API_URL' >> .env
Run server (Port 3000)
$ npm start
Run tests (Port 8080)
$ npm test
Test API with cURL
Get Vehicle Data
$ curl http://localhost:3000/api/v1/vehicles/1234 -X GET
Get Safety Data
$ curl http://localhost:3000/api/v1/vehicles/1234/doors -X GET
Get Fuel Data
$ curl http://localhost:3000/api/v1/vehicles/1234/fuel -X GET
Get Battery Data
$ curl http://localhost:3000/api/v1/vehicles/1235/battery -X GET
Post to Start or Stop Vehicle
$ curl http://localhost:3000/api/v1/vehicles/1234/engine -X POST -H "Content-Type: application/json" -d '{"action": "START|STOP"}'
Test API with Postman