Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- browser="google-chrome"
- dir="node_webserver"
- mkdir $dir
- cd $dir
- if [ ! -f "/usr/bin/nodejs" ]
- then
- sudo apt-get install nodejs
- fi
- npm install --save express@4.10.2
- cat << EOF > server.js
- var app = require('express')();
- var http = require('http').Server(app);
- app.get('/', function(req, res){
- res.sendFile(__dirname + '/index.html');
- });
- http.listen(3000, function(){
- console.log('listening on *:3000');
- });
- EOF
- cat << EOH > index.html
- <!doctype html>
- <html>
- <head>
- <title>Welcome</title>
- </head>
- <body>
- <h1>Hellow World</h1>
- <a href="http://filmsbykris.com">Learn More</a>
- </body>
- </html>
- EOH
- $browser "http://127.0.0.1:3000" &
- nodejs server.js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement