summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/express-app.js19
-rw-r--r--example/public/index.html13
2 files changed, 32 insertions, 0 deletions
diff --git a/example/express-app.js b/example/express-app.js
new file mode 100644
index 0000000..9342f66
--- /dev/null
+++ b/example/express-app.js
@@ -0,0 +1,19 @@
+var express = require('express');
+var MjpegProxy = require('../mjpeg-proxy').MjpegProxy;
+
+var cam1 = "http://admin:admin@192.168.124.54/cgi/mjpg/mjpg.cgi";
+var cam2 = "http://admin:@192.168.124.32/videostream.cgi";
+
+var app = express();
+
+app.set("view options", {layout: false});
+app.use(express.static(__dirname + '/public'));
+
+app.get('/', function(req, res) {
+ res.render('index.html');
+});
+
+app.get('/index1.jpg', new MjpegProxy(cam1).proxyRequest);
+app.get('/index2.jpg', new MjpegProxy(cam2).proxyRequest);
+
+app.listen(8080) \ No newline at end of file
diff --git a/example/public/index.html b/example/public/index.html
new file mode 100644
index 0000000..c7d3e9d
--- /dev/null
+++ b/example/public/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Node MJPEG Proxy Example</title>
+</head>
+<body>
+
+<img src="index1.jpg" />
+<img src="index2.jpg" />
+
+</body>
+</html>