Last active
May 29, 2016 04:53
-
-
Save nishinoshake/1d9df8f81270f49bbd1a to your computer and use it in GitHub Desktop.
Node.jsでPOSTデータを使う
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.post('/send/', function(req, res){ | |
var s1 = req.body.s1 ? req.body.s1: 0, | |
s2 = req.body.s2 ? req.body.s2: 0, | |
s3 = req.body.s3 ? req.body.s3: 0; | |
io.sockets.emit('socket_sensor', [s1, s2, s3]); | |
res.send('OK'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment