-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (26 loc) · 765 Bytes
/
index.js
File metadata and controls
31 lines (26 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}))
app.get('/markers', (req, res) => {
const the_data = {
worked: 'YAy'
}
res.status(200).send('Hello World')
})
app.post('/markers', (req,res) => {
try {
const data = req.body
let temp = req.body.temp
let humidity = req.body.humidity
let hasFallen = req.body.fall
} catch (e) {
res.status(500).send('Nan')
}
})
const server = app.listen(8080, () => {
const host = server.address().address
const port = server.address().port
console.log(`Example app listening at http://${host}:${port}`);
})