Skip to content

Instantly share code, notes, and snippets.

@gabonator
Created May 14, 2024 22:56
Show Gist options
  • Save gabonator/f11913e5ca5f03c1dbe4724392f4bbdb to your computer and use it in GitHub Desktop.
Save gabonator/f11913e5ca5f03c1dbe4724392f4bbdb to your computer and use it in GitHub Desktop.
arduino ota fake server with bonjour announcement
// 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