Added a normal http.createServer example
Esse commit está contido em:
@@ -0,0 +1,10 @@
|
||||
var http = require("http"),
|
||||
drone = require("../../index");
|
||||
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
require("fs").createReadStream(__dirname + "/index.html").pipe(res);
|
||||
});
|
||||
|
||||
drone.listen(server);
|
||||
server.listen(5555);
|
||||
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Stream as module</title>
|
||||
<script src="/dronestream/nodecopter-client.js" type="text/javascript" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="heading">Stream through a normal require("http").createServer</h1>
|
||||
<div id="droneStream" style="width: 640px; height: 360px"> </div>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
new NodecopterStream(document.getElementById("droneStream"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
var express = require('express')
|
||||
, routes = require('./routes')
|
||||
, app = express()
|
||||
, path = require('path')
|
||||
, server = require("http").createServer(app)
|
||||
;
|
||||
|
||||
|
||||
app.configure(function () {
|
||||
app.set('views', __dirname + '/views');
|
||||
app.set('view engine', 'jade', { pretty: true });
|
||||
app.use(express.favicon());
|
||||
app.use(express.logger('dev'));
|
||||
app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
});
|
||||
|
||||
app.configure('development', function () {
|
||||
app.use(express.errorHandler());
|
||||
app.locals.pretty = true;
|
||||
});
|
||||
|
||||
app.get('/', routes.index);
|
||||
|
||||
/*
|
||||
* Important:
|
||||
*
|
||||
* pass in the server object to listen, not the express app
|
||||
* call 'listen' on the server, not the express app
|
||||
*/
|
||||
// should be require("node-dronestream").listen(server)
|
||||
require("../../index").listen(server);
|
||||
server.listen(3000);
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "dronestream-example",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"express": "3.0.0rc5",
|
||||
"jade": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app"
|
||||
},
|
||||
"author": "Bernhard K. Weisshuhn <bkw@codingforce.com>",
|
||||
"license": "BSD"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
|
||||
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}
|
||||
audio,canvas,video{display:inline-block;*display:inline;*zoom:1}
|
||||
audio:not([controls]){display:none;height:0}
|
||||
[hidden]{display:none}
|
||||
html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}
|
||||
html,button,input,select,textarea{font-family:sans-serif}
|
||||
body{margin:0}
|
||||
a:focus{outline:thin dotted}
|
||||
a:active,a:hover{outline:0}
|
||||
h1{font-size:2em;margin:.67em 0}
|
||||
h2{font-size:1.5em;margin:.83em 0}
|
||||
h3{font-size:1.17em;margin:1em 0}
|
||||
h4{font-size:1em;margin:1.33em 0}
|
||||
h5{font-size:.83em;margin:1.67em 0}
|
||||
h6{font-size:.75em;margin:2.33em 0}
|
||||
abbr[title]{border-bottom:1px dotted}
|
||||
b,strong{font-weight:bold}
|
||||
blockquote{margin:1em 40px}
|
||||
dfn{font-style:italic}
|
||||
mark{background:#ff0;color:#000}
|
||||
p,pre{margin:1em 0}
|
||||
code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}
|
||||
pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}
|
||||
q{quotes:none}
|
||||
q:before,q:after{content:'';content:none}
|
||||
small{font-size:80%}
|
||||
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
|
||||
sup{top:-0.5em}
|
||||
sub{bottom:-0.25em}
|
||||
dl,menu,ol,ul{margin:1em 0}
|
||||
dd{margin:0 0 0 40px}
|
||||
menu,ol,ul{padding:0 0 0 40px}
|
||||
nav ul,nav ol{list-style:none;list-style-image:none}
|
||||
img{border:0;-ms-interpolation-mode:bicubic}
|
||||
svg:not(:root){overflow:hidden}
|
||||
figure{margin:0}
|
||||
form{margin:0}
|
||||
fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em}
|
||||
legend{border:0;padding:0;white-space:normal;*margin-left:-7px}
|
||||
button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}
|
||||
button,input{line-height:normal}
|
||||
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}
|
||||
button[disabled],input[disabled]{cursor:default}
|
||||
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}
|
||||
input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
|
||||
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
|
||||
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
|
||||
textarea{overflow:auto;vertical-align:top}
|
||||
table{border-collapse:collapse;border-spacing:0}
|
||||
@@ -0,0 +1,8 @@
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00B7FF;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* GET home page.
|
||||
*/
|
||||
|
||||
exports.index = function (req, res) {
|
||||
res.render('index', { title: 'Express' });
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
extends layout
|
||||
|
||||
block append head
|
||||
script(type='text/javascript', src='/dronestream/nodecopter-client.js')
|
||||
|
||||
-# for developing the client, use those url:s
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/sylvester.js')
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/glUtils.js')
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/util.js')
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/avc-codec.js')
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/avc.js')
|
||||
-# script(type='text/javascript', src='/dronestream/vendor/broadway/canvas.js')
|
||||
-# script(type='text/javascript', src='/dronestream/nodecopter-stream.js')
|
||||
-# concatenated version of client
|
||||
|
||||
|
||||
block append bodyscripts
|
||||
script
|
||||
var copterStream = new NodecopterStream(document.querySelector('#dronestream'));
|
||||
|
||||
block content
|
||||
div#dronestream(width=640, height=360)
|
||||
@@ -0,0 +1,30 @@
|
||||
!!! 5
|
||||
html
|
||||
block head
|
||||
head
|
||||
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
|
||||
meta(name='viewport', content='width=device-width')
|
||||
title= title
|
||||
link(rel='stylesheet', href='/css/normalize.min.css')
|
||||
link(rel='stylesheet', href='/css/style.css')
|
||||
body
|
||||
div.header-container
|
||||
header.wrapper.clearfix
|
||||
block header
|
||||
nav
|
||||
block navigation
|
||||
|
||||
div.main-container
|
||||
div.main.wrapper.clearfix
|
||||
|
||||
block content
|
||||
|
||||
|
||||
div.footer-container
|
||||
footer.wrapper
|
||||
block footer
|
||||
|
||||
block bodyscripts
|
||||
// script(src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js')
|
||||
// script
|
||||
// window.jQuery || document.write('<script src="/js/vendor/h5bp/jquery-1.8.2.min.js"><\\x3C/script>')
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require("./lib/server");
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
"type": "git",
|
||||
"url": "git@github.com:bkw/node-dronestream.git"
|
||||
},
|
||||
"main": "lib/server",
|
||||
"main": "index",
|
||||
"keywords": [
|
||||
"drone",
|
||||
"nodecopter",
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário