Skip to content

A greenhouse monitor can receive data and draw line charts from any device that can send http message(support REST api), esp8266, for example. Using Node.js, Express & MongoDB.

Notifications You must be signed in to change notification settings

shwezhu/greenhouse-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

1. Client


LineCharts are drawn by ChartJS in plain Javascript. Support adjust x-axis automatically with time changing.

Get data from database in Node.JS.

Screen Shot 2022-10-11 at 15 51 43

2. Server


Using Mongodb database with Node.JS, Express.JS...

  1. 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.
  2. remember your collections and database name, if you don't know how to create database in MongoDB, google it
  3. change source code in server, just as picture below:

database

database 2

url

2.1. Run server

cd GreenhouseMonitor/server/
# install dependencies
npm install
# run server
npm start

2.2. Test

# 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/

About

A greenhouse monitor can receive data and draw line charts from any device that can send http message(support REST api), esp8266, for example. Using Node.js, Express & MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published