Express.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 16: | Line 16: | ||
</pre> |
</pre> |
||
Browse |
Browse http://localhost:3000 |
||
==Extra : [[HTTPS]]== |
|||
<pre> |
|||
mkdir cert |
|||
cd cert |
|||
openssl genrsa 1024 > key.pem |
|||
openssl req -x509 -new -key key.pem > key-cert.pem |
|||
</pre> |
|||
<pre> |
|||
ar express = require('express') |
|||
, fs = require('fs') |
|||
, routes = require('./routes'); |
|||
var privateKey = fs.readFileSync('cert/key.pem').toString(); |
|||
var certificate = fs.readFileSync('cert/key-cert.pem').toString(); |
|||
// To enable HTTPS |
|||
var app = module.exports = express.createServer({key: privateKey, cert: certificate}); |
|||
.. |
|||
</pre> |
|||
==Ressources== |
==Ressources== |
Latest revision as of 19:48, 1 September 2014
sudo npm install -g express sudo npm install -g express-generator express --help express -e myapp cd myapp ls -al sudo npm install DEBUG=myapp ./bin/www
Browse http://localhost:3000
Extra : HTTPS
mkdir cert cd cert openssl genrsa 1024 > key.pem openssl req -x509 -new -key key.pem > key-cert.pem
ar express = require('express') , fs = require('fs') , routes = require('./routes'); var privateKey = fs.readFileSync('cert/key.pem').toString(); var certificate = fs.readFileSync('cert/key-cert.pem').toString(); // To enable HTTPS var app = module.exports = express.createServer({key: privateKey, cert: certificate}); ..