Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB + NodeJS + ExpressJs + MQTT adafruit

User APIs

Get all users(Get)

http://localhost:8081/users

Get user by id(Get)

http://localhost:8081/user?userid=2222

Add new user(Post)

http://localhost:8081/user

{
      "userid":"33333",
	    "lowerboundtemp":"13",
    	"upperboundtemp":"22",
    	"lowerboundhumid":"23",
    	"upperboundhumid":"24",
        "adaUsername":"vandat2000",
        "adaPassword":"aio_c",
    	"routine1":[
      		{
      			"starttime":"332443243",
      			"endtime":"2243443322334",
      			"divice":"fan"
      		}
    	],
    	"routine2":[
      		{
      			"time":"13433532342",
      			"divece":"fan",
      			"status": "1" 
      		}
      	],
      "history":[
      		{
      			"time":"15234324324",
      			"notification": "hông ẩm gì hết trơn á"
      		}
      ]
  }

Add history by user(Patch)

http://localhost:8081/user/history/:userid

  {
    "time":"15234324324",
    "notification": "nóng quá trời nè"
  }

Update lower bound temp

http://localhost:8081/user/lowertemp/:userid

{
    "value":"10"
}

Update upper bound temp

http://localhost:8081/user/uppertemp/:userid

{
    "value":"10"
}

Update lower bound humid

http://localhost:8081/user/lowerhumid/:userid

{
    "value":"10"
}

Update upper bound humid

http://localhost:8081/user/upperhumid/:userid

{
    "value":"10"
}

Routine

Get all routines(Get)

http://localhost:8081/routines

Get routine by id(Get)

http://localhost:8081/routine/:id

Add new routine(Post)

http://localhost:8081/routine

{
        "userid":"22222",
        "time": 1651543154486,
        "device": "pump",
        "status": "ON"
}

Delete routine(Delete)

http://localhost:8081/routine/:id

User interface github link

https://github.com/datphamcode295/happyfarm.git

Note: add file .env: MONGODBLINK = 'mongodb+srv://datbk:123456789dat@cluster0.punaw.mongodb.net/myFirstDatabase?retryWrites=true&w=majority' before running

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages