Jade



Jade

0 0


getting-started-with-express

Introduction to express

On Github saintedlama / getting-started-with-express

Getting Started with Express.js

A quick intro to express.js

Express.js

  • Minimalistic framework
  • Handles routing and views
  • All other stuff is handled by modules
  • npm install express -g
  • express
  • Scaffold express projects

Express skeleton *

  • app.js
    • middleware setup
  • bin/www
    • Start the "server"
  • public
    • Assets: images, css, ...
  • views
    • Frontend
  • routes
    • Backend

A Quick Tour *

  • Route function
  • Render a view
  • Add dynamic data
  • Add a form
  • POST Route function

Jade

doctype html
html(lang="en")
  head
    title= pageTitle
    script(type='text/javascript').
      if (foo) {
         bar(1 + 5)
      }
  body
    h1 Jade - node template engine
    #container.col
      if youAreUsingJade
        p You are amazing
      else
        p Get on it!
      p.
        Jade is a terse and simple
        templating language with a
        strong focus on performance
        and powerful features.

Fundamentals

http://jade-lang.com/reference/

Memetron

  • It's hard to keep track of the best memes
  • It's even harder to keep track where these were used
  • -> Memetron!

Memetron *

  • Scaffold
    • mkdir memetron cd memetron express
  • I'm using bootstrap
    • I'm a CSS noob
  • Where to put assets (css, js, images, stuff)
  • Layout
  • Run the app npm install nodemon -g

Request flow

Walkthrough *

  • Application Setup
  • Authentication
  • CRUD Operations for Meme

Authentication *

  • There is a module
  • What a surprise
  • npm install passport --save
  • npm install passport-local --save

Thanks!

MongoDB and persistence next!