Created
May 14, 2024 22:56
-
-
Save gabonator/f11913e5ca5f03c1dbe4724392f4bbdb to your computer and use it in GitHub Desktop.
arduino ota fake server with bonjour announcement
This file contains 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
// dns-sd -R gabo5 _arduino._tcp . 3005 ssh_upload=no | |
const express = require('express'); | |
const app = express(); | |
app.use((req, res, next) => { | |
console.log(Date.now(), req.method, req.url); | |
next(); | |
}); | |
app.post('/pgm/sync', (req, res) => { | |
res.status(204).end(); | |
}); | |
app.get('/pgm/sync', (req, res) => { | |
res.status(200).end("SYNC"); | |
}); | |
app.post('/log/reset', (req, res) => { | |
res.write("reset - OK"); | |
}); | |
app.post('/pgm/upload', (req, res) => { | |
var d = ""; | |
req.on('data', data => d += data.toString()); | |
req.on('end', () => console.log(d.split(":").join("\n:"))); | |
res.send('flasing - OK'); | |
}); | |
app.listen(3005); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment