Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SunKing2/00774b809d2cb9cb39b6ec503086e517 to your computer and use it in GitHub Desktop.
Save SunKing2/00774b809d2cb9cb39b6ec503086e517 to your computer and use it in GitHub Desktop.
Installing node, first app with Express with Ubuntu 17.04
cd Documents
mkdir first
cd first
sudo apt-get install -y curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn
yarn init -y
yarn add express express-handlebars
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
cat > app.js<<EOL
let express = require('express')
let app = express()
app.get('/', function(req, res) {
res.send(' <h1>Hello Github-gist world</h1>')
})
app.listen(3000, function() {
console.log('app listening on port 3000')
})
EOL
xterm -e "chromium-browser"&
xterm -e "node app.js"&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment