diff options
author | Georges-Etienne Legendre <legege@legege.com> | 2013-02-04 13:39:06 -0500 |
---|---|---|
committer | Georges-Etienne Legendre <legege@legege.com> | 2013-02-04 13:39:06 -0500 |
commit | 91736294567db46f2f309f53c42f287622e21591 (patch) | |
tree | 0878000735dccb01e2baf67531636acb5dae33d1 /example | |
parent | cfe2dbe5bb3bbb87ac7ab29390a30d8f592391f3 (diff) |
A module version of this application, with express.js
Diffstat (limited to 'example')
-rw-r--r-- | example/express-app.js | 19 | ||||
-rw-r--r-- | example/public/index.html | 13 |
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> |