Skip to content

Instantly share code, notes, and snippets.

@binario200
Last active April 8, 2016 18:58
Show Gist options
  • Save binario200/8090a00c92977be7296bf1a281d72dce to your computer and use it in GitHub Desktop.
Save binario200/8090a00c92977be7296bf1a281d72dce to your computer and use it in GitHub Desktop.
html
head
title=title
link(href='//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet')
body
div.container
div.jumbotron
h1 Hello!
if user
p Welcome, #{user.fullName}
p
a.small(href="profile") Edit my profile
form(action='/logout', method='POST')
button.btn.btn-default(type="submit") Logout
else
p Welcome to my app, ready to get started?
p
a.btn.btn-primary(href="/login") Login now
p
span.small Don't have an account?
span  
a.small(href="/register") Register now
## taken from https://stormpath.com/blog/build-nodejs-express-stormpath-app/
## you will find there what is what.
mkdir the-app
cd the-app
## create a package.json used by Node.js to keep track what modules your projects depeneds on.
npm init
## Now let’s install the libraries we want to use.
npm i --save express cookie-parser csurf jade forms xtend body-parser
## install a watcher
npm install -g nodemon
## create server.js
touch server.js
## server.js
## create the jade view whithin views dir, check the home.jade
touch home.jade
## run the app
node server.js
var express = require('express');
var app = express();
app.set('views', './views');
app.set('view engine', 'jade');
app.get('/', function(req, res) {
res.render('Home', {
title: 'My-App-Home'
});
});
app.on('stormpath.ready',function(){
console.log('My-app is read');
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment