is-ihm/back/index.js

19 lines
509 B
JavaScript

const express = require("express");
const app = express();
const http = require("http");
http.get("http://192.168.4.1/", (cameraRes) => {
app.get("/api/video", (req, res) => {
res.writeHead(200, {
"Content-Type": "multipart/x-mixed-replace; boundary=123456789000000000000987654321"
});
cameraRes.on("data", (chunk) => {
res.write(chunk)
});
cameraRes.on("end", () => res.end());
});
});
app.listen(3000, () => console.log("Server running on http://localhost:3000"));