summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRoberto De Ioris <info@unbit.it>2013-08-06 07:36:16 +0200
committerRoberto De Ioris <info@unbit.it>2013-08-06 07:36:16 +0200
commit40054e3494cea76a0806664613b8e09682b961e4 (patch)
tree079d4ea31a854a30f2bfcdaa864bb8e4d51f0b39 /examples
parent8927dfd538c7f0d9307d82b37e53165d03755176 (diff)
downloaduwsgi-40054e3494cea76a0806664613b8e09682b961e4.tar.gz
another series of mv
Diffstat (limited to 'examples')
-rw-r--r--examples/mjpeg_stream.py26
-rw-r--r--examples/mojoapp.pl23
2 files changed, 49 insertions, 0 deletions
diff --git a/examples/mjpeg_stream.py b/examples/mjpeg_stream.py
new file mode 100644
index 00000000..20c33438
--- /dev/null
+++ b/examples/mjpeg_stream.py
@@ -0,0 +1,26 @@
+import uwsgi
+
+import os
+
+def application(env, start_response):
+
+ boundary = 'uwsgi_mjpeg_frame'
+
+ start_response('200 Ok', [
+
+ ('Cache-Control', 'no-cache'),
+ ('Cache-Control', 'private'),
+ ('Pragma', 'no-cache'),
+ ('Content-Type', 'multipart/x-mixed-replace; boundary=' + boundary),
+ ]
+ )
+
+
+ yield "--%s\n" % boundary
+
+ while 1:
+ yield "Content-Type: image/jpeg\r\n\r\n"
+ uwsgi.sendfile('screenshot.jpg')
+ yield "--%s\n" % boundary
+ #os.system('./isightcapture -w 640 -h 480 screenshot.jpg')
+ #os.system('screencapture -m -T 1 screenshot.jpg')
diff --git a/examples/mojoapp.pl b/examples/mojoapp.pl
new file mode 100644
index 00000000..221fca23
--- /dev/null
+++ b/examples/mojoapp.pl
@@ -0,0 +1,23 @@
+use Mojolicious::Lite;
+
+# /
+get '/' => 'index';
+
+# /*
+get '/:groovy' => sub {
+ my $self = shift;
+ $self->render_text($self->param('groovy'), layout => 'funky');
+};
+
+app->start('psgi');
+__DATA__
+
+@@ index.html.ep
+% layout 'funky';
+Yea baby!
+
+@@ layouts/funky.html.ep
+<!doctype html><html>
+ <head><title>Funky!</title></head>
+ <body><%= content %></body>
+</html>