Skip to content

Commit

Permalink
Update spark example to not depend on connect.
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Jul 21, 2010
1 parent 9d84e5a commit d43b6b0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 36 deletions.
10 changes: 5 additions & 5 deletions bin/spark
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/*!
* Ext JS Connect
* Ext JS Spark
* Copyright(c) 2010 Sencha Inc.
* MIT Licensed
*/
Expand Down Expand Up @@ -48,8 +48,8 @@ var useColors = true;
* Environment defaults.
*/

var env = process.connectEnv = {
name: process.env.CONNECT_ENV || 'development',
var env = process.sparkEnv = {
name: process.env.SPARK_ENV || 'development',
port: 3000,
host: null
};
Expand All @@ -76,10 +76,10 @@ var usage = ''
+ ' -u, --user ID|NAME Change user with setuid()\n'
+ ' -g, --group ID|NAME Change group with setgid()\n'
+ ' -v, --verbose Enable verbose output\n'
+ ' -V, --version Output connect version\n'
+ ' -V, --version Output spark version\n'
+ ' -K, --no-color Suppress colored terminal output\n'
+ ' -h, --help Outputy help information\n'
+ ' --ENV VAL Sets the given connect environment variable\n'
+ ' --ENV VAL Sets the given spark environment variable\n'
;

/**
Expand Down
4 changes: 2 additions & 2 deletions examples/config/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
var http = require('http');

/**
* `$ connect --chdir examples/config`
* `$ spark --chdir examples/config`
* will auto-detect ./config.js and apply it.
*
* `$ connect --config path/to/config examples/config.app`
* `$ spark --config path/to/config examples/config.app`
* will load the app relative to CWD, and the given config module.
*
* NOTE: you can use --config several times to apply different configurations
Expand Down
12 changes: 6 additions & 6 deletions examples/custom-config/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
*/

var sys = require('sys'),
Connect = require('./../../lib/connect');
http = require('http');

// Based on the current env name require / mixin the
// additional file-based configuration. Try using
// --env production

var conf = require('./config/' + process.connectEnv.name);
var conf = require('./config/' + process.sparkEnv.name);
for (var key in conf) {
process.connectEnv[key] = conf[key];
process.sparkEnv[key] = conf[key];
}

sys.log('loading config file "config/' + process.connectEnv.name + '.js"');
sys.log('loading config file "config/' + process.sparkEnv.name + '.js"');

module.exports = Connect.createServer(function(req, res, next){
module.exports = http.createServer(function(req, res, next){
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(sys.inspect(process.connectEnv));
res.end(sys.inspect(process.sparkEnv));
});
9 changes: 0 additions & 9 deletions examples/hello-world/app.js

This file was deleted.

3 changes: 0 additions & 3 deletions examples/hello-world/run.js

This file was deleted.

8 changes: 2 additions & 6 deletions examples/node/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@

/**
* Module dependencies.
*/

// Yes, this is a vanilla node app
var http = require('http');

module.exports = require('http').createServer(function(req, res){
module.exports = http.createServer(function(req, res){
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(this.env.name);
});
4 changes: 2 additions & 2 deletions examples/ssl/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Connect = require('../../lib/connect');
var http = require('http');

module.exports = Connect.createServer(function(req, res) {
module.exports = http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
var secure = req.socket.secure;
res.end('secure=' + secure + ', that is ' + (secure ? 'good' : 'bad'));
Expand Down
3 changes: 2 additions & 1 deletion examples/ssl/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ var creds = crypto.createCredentials(
});
app.setSecure(creds);

app.listen();
app.listen(3000);
console.log("https://localhost:3000/")
4 changes: 2 additions & 2 deletions examples/ssl/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Use ./genkeycert.sh before running!
#
# Demonstrates usage of SSL support in the connect(1) binary.
# Demonstrates usage of SSL support in the executable(1) binary.
#

../../bin/connect --ssl-key privatekey.pem --ssl-crt certificate.pem
../../bin/spark --ssl-key privatekey.pem --ssl-crt certificate.pem

0 comments on commit d43b6b0

Please sign in to comment.