Powered by Express JS | ACES Labs
Clone repositories:
git clone https://github.com/ghofaralhasyim/smart-farm-backend.git
Open directory:
cd smart-farm-backend
Install dependencies:
npm i
Start smart-farm-backend:
nodemon start
*notes : if nodemon unrecognized command, you need to install nodemon globaly: npm install -g nodemon
DB_URI={your_mongo_uri_access}
JWT_KEY={your_jwt_secret_key}
API URL : https://smart-farm-backend.vercel.app
Get all data logs (admin)
GET /api/data-logs
Get data log by id(admin)
GET /api/data-logs/{id_log}
Post single data
POST /api/data-logs/add-single-data
body: { "timestamp": 1664264826855, "idNode": 3, "airTemp": 0.5, "airHum": 25.5, "soilHum": 25.5, "gps": { "lat": 12.2823, "long": -34.23 } }
Post multiple data
POST /api/data-logs/add-data
body: [object, object, ...] object : { "timestamp": 1664264826855, "idNode": 3, "airTemp": 0.5, "airHum": 25.5, "soilHum": 25.5, "gps": { "lat": 12.2823, "long": -34.23 } }
Generate gateway token:
POST /api/gateways/generate
body: { "name" : "testt" }
User sign in
POST /api/user/signin
body: { "email": "[email protected]", "password": "VerySecurePassword" }
List all users(admin)
GET /api/user/all
Sign up new user
POST /api/user/all
body: { "email": "[email protected]", "password": "VerySecurePassword" }
Sign up new admin(admin)
POST /api/user/adminSignup
body: { "email": "[email protected]", "password": "VerySecurePassword" }
Verify a user(admin)
PUT /api/user/userVerify
body: { "_id": "akdfainadlanf" }