Skip to content

NghiaTranUIT/intro-it-assignment-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

  • Smart Garden Project

NodeJS Server

Setup

Useage

## Move to server folder
$ cd server

## Install dependency
$ npm install

## Start a server
$ node index.js

## Open at localhost:3000 on Google Chrome

Endpoint

Post Sensor data

  • POST /api/sensor
  • Header: content-type: application/json
  • Body JSON with a following format
{
    "temperature": 20,
    "moisture": 30,
    "light": 40
}

Example

curl --request POST \
  --url http://localhost:3000/api/sensor \
  --header 'content-type: application/json' \
  --data '{
    "temperature": 20.232,
    "moisture": 20.123213,
    "light": 50
}'

How to regenerate a Token

  1. Delete server/token.json
  2. Run
node index.js
  1. Copy a link on the terminal and start authorizing
  2. Follow the guideline
  3. Commit and push

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published