Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bump version, https support

  • Loading branch information...
commit 40355704dbc5527f241b0be3e9eb9e5a69975410 1 parent 1ed8523
Anatoliy Chakkaev authored
View
11 CHANGELOG.md
@@ -1,3 +1,14 @@
+0.1.3
+
+HTTPS Support
+-------------
+
+Just place your key and cert into config directory, railway will use it.
+Default names for keys are `tsl.key` and `tsl.cert`, but you can store in in another place, in that case just pass filenames to createServer function:
+`server.js`
+
+ require('railway').createServer({key: '/tmp/key.pem', cert: '/tmp/cert.pem'});
+
0.1.2
- npmfile
View
20 README.md
@@ -65,7 +65,25 @@ On initialization rails-like directories tree generated, like that:
| `-- posts_helper.js
`-- config
|-- database.json
- `-- routes.js
+ |-- routes.js
+ |-- tsl.cert
+ `-- tsl.key
+
+HTTPS Support
+-------------
+
+Just place your key and cert into config directory, railway will use it.
+Default names for keys are `tsl.key` and `tsl.cert`, but you can store in in another place, in that case just pass filenames to createServer function:
+`server.js`
+
+ require('railway').createServer({key: '/tmp/key.pem', cert: '/tmp/cert.pem'});
+
+Few helpful commands:
+
+ # generate private key
+ openssl genrsa -out config/tsl.key
+ # generate cert
+ openssl req -new -x509 -key config/tsl.key -out config/tsl.cert -days 1095 -batch
Routing
-------
View
8 lib/onrailway.js
@@ -37,10 +37,12 @@ exports.init = function (app) {
};
};
-exports.createServer = function () {
+exports.createServer = function (options) {
+ options = options || {};
+
var keys, app,
- key = process.cwd() + '/config/tsl.key',
- cert = process.cwd() + '/config/tsl.cert';
+ key = options.key || process.cwd() + '/config/tsl.key',
+ cert = options.cert || process.cwd() + '/config/tsl.cert';
if (path.existsSync(key) && path.existsSync(cert)) {
keys = {
View
2  package.json
@@ -1,5 +1,5 @@
{ "name": "railway"
-, "version": "0.1.2"
+, "version": "0.1.3"
, "author": "Anatoliy Chakkaev"
, "description": "Railway features for Express.js framework"
, "homepage": "http://github.com/1602/express-on-railway"
View
4 templates/server.coffee
@@ -1,8 +1,6 @@
#!/usr/bin/env coffee
-app = module.exports = require('express').createServer()
-
-require('express-on-railway').init(app)
+app = module.exports = require('railway').createServer()
if not module.parent
app.listen 3000
View
4 templates/server.js
@@ -1,8 +1,6 @@
#!/usr/bin/env node
-var app = module.exports = require('express').createServer();
-
-require('express-on-railway').init(app);
+var app = module.exports = require('railway').createServer();
if (!module.parent) {
app.listen(3000);
Please sign in to comment.
Something went wrong with that request. Please try again.