LineCharts are drawn by ChartJS in plain Javascript. Support adjust x-axis automatically with time changing.
Get data from database in Node.JS.
Using Mongodb database with Node.JS, Express.JS...
- You should install MongoDB and create database and collections(collection is similar to table in relational database, MongoDB is not a relational database) first, because this project(server) use MongoDB as database.
- remember your collections and database name, if you don't know how to create database in MongoDB, google it
- change source code in server, just as picture below:
cd GreenhouseMonitor/server/
# install dependencies
npm install
# run server
npm start
# get data
curl -X GET "localhost:3001/temperature/?startDate=2022-09-20&endDate=2022-09-30"
# post data
curl -d '{ "value": 20.6 }' -H "Content-Type: application/json" -X POST http://localhost:3001/temperature/