SlideShare a Scribd company logo
1 of 37
MODERN WEB DEVELOPMENT:
   JAVASCRIPT GALORE
       Jamie DAVIDSON and Roberto Fuentes




   Startup Institute boston // follow me : @jamiehdavidson
Who am I?
                              Web Developer/Full Stack Engineer



                              2+ years Rails experience



                              Angularjs, coffeescript, sass




            Startup Institute boston // follow me : @jamiehdavidson
+   What we’ll cover




                                                    + Express

                       Startup Institute boston // follow me : @jamiehdavidson
Disclaimer
                I don’t really know node
                 But let’s learn together




Startup Institute boston // follow me : @jamiehdavidson
Why Node?



              ✓Same language you use on the client

      ✓You’re building a data-intensive, real time application

        ✓you’re building your company’s mobile Web app

                ✓You want to use the newest stuff



                    Startup Institute boston // follow me : @jamiehdavidson
+   What should i know about node



                                 1      If you’ve only be using jquery for your javascript, you might
                                        want to stay away




                                2       It’s still a teenager, so it requires patience




                                 3      Documentation, conventions, and libraries are still being
                                        established




                   Startup Institute boston // follow me : @jamiehdavidson
Node package manager (Npm)




                     essentially, it’s bundler


                   npm install [library] --save




                   Startup Institute boston // follow me : @jamiehdavidson
+      Web frameworks

The default
Express

The cool kid
Meteor
Many others
SocketStream
- “Dedicated to building single page realtime apps”

Derby                                                              You can only build a web server
Sails                                                              with node. you need one of these to
- Rails inspired
                                                                   build a web app
Tower
- Also Rails inspired

Compound
flatiron                                 Startup Institute boston // follow me : @jamiehdavidson
Javascript mvc on the client
Angularjs

                              developed by google



                              Models, controllers, templates, Directives




            Startup Institute boston // follow me : @jamiehdavidson
+   Why Angular?


                     ✓Well, google developed it
       ✓you’re building a website with rich functionality and
                                    interactivity

                     ✓you hate full page loads

     ✓you want to write tests for your client-side javascript too

                        ✓small learning curve

                       Startup Institute boston // follow me : @ jamiehdavidson
+   What should i know about Angular



                                1        one-page web apps = difficult seo management




                                2        there’s a fight to be the de facto mvc Js client winner.
                                         angular may win, it may not




                                 3       documentation can be inconsistent (although i hear it’s
                                         better than ember’s)




                    Startup Institute boston // follow me : @ jamiehdavidson
HTML and css




Startup Institute boston // follow me : @ jamiehdavidson
+   Sass over css




                    Startup Institute boston // follow me : @ jamiehdavidson
+   What should i know about Sass



                                 1        Browsers don’t know what a sass (or scss) file is. they still
                                          want css




                                 2        with node, use compass to automatically compile sass to
                                          css. rails uses sass by default




                                 3       it’s easy to understand. there ’s no reason to not use it




                                4        When used correctly, it can make cross-browser styling
                                         much, much, much easier




                     Startup Institute boston // follow me : @ jamiehdavidson
+   plain old html also sucks



     HTML                                HaML                                    Jade




                      Startup Institute boston // follow me : @ jamiehdavidson
+      What should i know about haml/jade



                                    1        Browsers don’t know what a haml or jade file is. they want
                                             html


    closing html tags


                                    2        jade is default in node and will automatically handle
                                             conversion to html




                                     3       it’s easy to understand. there ’s no reason to not use it




                        Startup Institute boston // follow me : @ jamiehdavidson
Let’s Build Something!!
            But first, visit:
http://cryptic-headland-3164.herokuapp.com/




          Startup Institute boston // follow me : @ jamiehdavidson
Disclaimer
  There are no tests




 But you should follow
test-driven development
    Startup Institute boston // follow me : @ jamiehdavidson
+ Step 1: The Core                                   A lot of this file is setup for you by running:
              app.js
                                                                express [project name]

                                                             Let’s use some Coffeescript
                                                                 npm install coffee-script --save




                                                                           Define your routes
                                                                     Remember, unlike Rails, Node and
                                                                          Express aren’t magic

                       Startup Institute boston // follow me : @jamiehdavidson
+   Step 1: The layout
            views/layout.jade

                                                                                   Better Fonts
                                                                                      Typekit
                                                                                    Google Fonts
                                                                                   Webfont Loader


                                                                                                 CSS
                                                                                       Always include Foundation
                                                                                   Include a route-specific stylesheet


                                                                      Template Inheritance over Layouts
                                                                                  apps/views/home/index.jade




                                Startup Institute boston // follow me : @jamiehdavidson
+       Step 1: Routes AND
              VIEWS
     apps/home/routes.coffee


                                                                    Set Page-Specific Variables
                                                            Set page title and page-specific stylesheet name




    apps/home/views/index.jade


                                                                            Route-Specific HTML
                                                                                   Nothing fancy yet




                                 Startup Institute boston // follow me : @jamiehdavidson
+STEP 1: Summary
          Download Node, NPM

          Install dependencies with ‘npm install’

          Install Foundation and use compass to compile scss -> css

          Use Fonts with typekit and Google Fonts. Load them with Webfont
          loader

          create a basic layout with foundation

          handle a route to the homepage. define a simple view to render




                          Startup Institute boston // follow me : @ jamiehdavidson
+   Step 2: CLient-side javascript




            Same rules apply

            1. keep it organized
            (i.e. not a whole bunch of jquery selectors)


            2. keep it to as few (minified) files if
            possible




                          Startup Institute boston // follow me : @ jamiehdavidson
+   Step 2: asset Pipeline

                 app.js

                                                                    Time for some Rails-like magic
                                                                         npm install connect-assets --save




                          Startup Institute boston // follow me : @jamiehdavidson
+STEP 2: Summary


          Download connect-assets

          SEtup your directory structure for some rails-like magic

          one javascript file to rule them all!




                           Startup Institute boston // follow me : @ jamiehdavidson
+   Step 3: Setting up a database
               app.js


                                                                   Mongo and Mongoose
                                                                      brew install mongodb
                                                                    npm install mongoose --save


                                                                     Your Mongo Server
                                                                                  mongod


                                                                         Mongo Models
                                                                  Require them! Again, no magic




                        Startup Institute boston // follow me : @jamiehdavidson
+    Step 3: Defining a model’s schema
            models/users.js                                                    apps/users/routes.coffee




    ✓Define an api for our users
    ✓No redirects or renders. All
                json

    ✓require the route in app.js
                              Startup Institute boston // follow me : @ jamiehdavidson
+STEP 3: Summary

          Download mongo and mongoose

          define a simple user model and its schema

          Define a rest api for our users

          Get ready for angular js




                          Startup Institute boston // follow me : @ jamiehdavidson
+   Step 4: Gimme some angular
       assets/js/skill-show.coffee
                                                                                                Dependency injection
                                                                                                   HTML5 Mode

        assets/js/services.coffee
                                                                                                  Automatic REST
                                                                                              Download angular-resource
                                                                                                Beware of minification



       assets/js/controllers.coffee


                                                                                              Initialize and add users




                                    Startup Institute boston // follow me : @jamiehdavidson
+   Step 4: angular in the view
           apps/home/views/index.jade

                                                                                    New scope
                                                                                    Create a new user

                                                                                    Bind to a dynamic model




                                                                                    Display all users




                                                                                    Default text when we
                                                                                        have no skills

                          Startup Institute boston // follow me : @jamiehdavidson
+STEP 4: Summary

          Create your angular app. reference it with ng-app

          use $resource for automatic rest communication with a model

          minification gotcha

          controllers create a new scope where we create variables and define
          events/methods
          remember ng-repeat, ng-model, ng-submit, ng-show....you’ll use
          them in every app




                          Startup Institute boston // follow me : @ jamiehdavidson
+   Step 5: Adding skills and searching


                                                                                Add a new skill




                                                                                    Bind to new ‘query’ model
                                                                               Filter users based on ‘query’ value

                                                                               A new controller/scope for every user
                                                                                ng-init acts as a scope ‘constructor’
                                                                                Show only when editing


                                                                               Special Angular form select

                                                                               Toggle the button when we go
                                                                                      into ‘edit mode’
                     Startup Institute boston // follow me : @jamiehdavidson
+STEP 5: Summary

          We can automatically search a collection client-side with one line of
          angular
          ng-init is used to initialize a variable in the current scope
          a controller inside a controller creates a child scope. the 2 scopes
          can communicate with each other through events
          use $watch to monitor for changes




                           Startup Institute boston // follow me : @ jamiehdavidson
+   Step 6: Creating a directive




                            Notice the embedded Angular bindings

                Directives are probably the most complicated aspect of Angular




                         Startup Institute boston // follow me : @jamiehdavidson
+   Step 6: routing a one-page app




     Old apps/home/views/index.jade                                         views/partials/users/index.jade



                                                   move to




                                                           change to



                              Startup Institute boston // follow me : @jamiehdavidson
+   STEP 6: The final conclusion


             Directives act as ‘widgets’, allowing you to define a unique/complex
             dom structure for a single dom element
             the directive documentation kinda sucks
             ng-class = conditional css classes
             the $routeprovider acts as a route handler: given a specific url, fetch
             and render a specific template
             ng-view defines where the template is rendered
             templates can contain angular bindings/expressions just like a view
             watch out for seo with one-page apps/a lot of dom manipulation




                             Startup Institute boston // follow me : @ jamiehdavidson
THANK
   S.                          FOR YOUR ATTENTION




Startup Institute boston // follow me : @jamiehdavidson

More Related Content

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Modern Web Development: Node.js and Angular

  • 1. MODERN WEB DEVELOPMENT: JAVASCRIPT GALORE Jamie DAVIDSON and Roberto Fuentes Startup Institute boston // follow me : @jamiehdavidson
  • 2. Who am I? Web Developer/Full Stack Engineer 2+ years Rails experience Angularjs, coffeescript, sass Startup Institute boston // follow me : @jamiehdavidson
  • 3. + What we’ll cover + Express Startup Institute boston // follow me : @jamiehdavidson
  • 4. Disclaimer I don’t really know node But let’s learn together Startup Institute boston // follow me : @jamiehdavidson
  • 5. Why Node? ✓Same language you use on the client ✓You’re building a data-intensive, real time application ✓you’re building your company’s mobile Web app ✓You want to use the newest stuff Startup Institute boston // follow me : @jamiehdavidson
  • 6. + What should i know about node 1 If you’ve only be using jquery for your javascript, you might want to stay away 2 It’s still a teenager, so it requires patience 3 Documentation, conventions, and libraries are still being established Startup Institute boston // follow me : @jamiehdavidson
  • 7. Node package manager (Npm) essentially, it’s bundler npm install [library] --save Startup Institute boston // follow me : @jamiehdavidson
  • 8. + Web frameworks The default Express The cool kid Meteor Many others SocketStream - “Dedicated to building single page realtime apps” Derby You can only build a web server Sails with node. you need one of these to - Rails inspired build a web app Tower - Also Rails inspired Compound flatiron Startup Institute boston // follow me : @jamiehdavidson
  • 9. Javascript mvc on the client Angularjs developed by google Models, controllers, templates, Directives Startup Institute boston // follow me : @jamiehdavidson
  • 10. + Why Angular? ✓Well, google developed it ✓you’re building a website with rich functionality and interactivity ✓you hate full page loads ✓you want to write tests for your client-side javascript too ✓small learning curve Startup Institute boston // follow me : @ jamiehdavidson
  • 11. + What should i know about Angular 1 one-page web apps = difficult seo management 2 there’s a fight to be the de facto mvc Js client winner. angular may win, it may not 3 documentation can be inconsistent (although i hear it’s better than ember’s) Startup Institute boston // follow me : @ jamiehdavidson
  • 12. HTML and css Startup Institute boston // follow me : @ jamiehdavidson
  • 13. + Sass over css Startup Institute boston // follow me : @ jamiehdavidson
  • 14. + What should i know about Sass 1 Browsers don’t know what a sass (or scss) file is. they still want css 2 with node, use compass to automatically compile sass to css. rails uses sass by default 3 it’s easy to understand. there ’s no reason to not use it 4 When used correctly, it can make cross-browser styling much, much, much easier Startup Institute boston // follow me : @ jamiehdavidson
  • 15. + plain old html also sucks HTML HaML Jade Startup Institute boston // follow me : @ jamiehdavidson
  • 16. + What should i know about haml/jade 1 Browsers don’t know what a haml or jade file is. they want html closing html tags 2 jade is default in node and will automatically handle conversion to html 3 it’s easy to understand. there ’s no reason to not use it Startup Institute boston // follow me : @ jamiehdavidson
  • 17. Let’s Build Something!! But first, visit: http://cryptic-headland-3164.herokuapp.com/ Startup Institute boston // follow me : @ jamiehdavidson
  • 18. Disclaimer There are no tests But you should follow test-driven development Startup Institute boston // follow me : @ jamiehdavidson
  • 19. + Step 1: The Core A lot of this file is setup for you by running: app.js express [project name] Let’s use some Coffeescript npm install coffee-script --save Define your routes Remember, unlike Rails, Node and Express aren’t magic Startup Institute boston // follow me : @jamiehdavidson
  • 20. + Step 1: The layout views/layout.jade Better Fonts Typekit Google Fonts Webfont Loader CSS Always include Foundation Include a route-specific stylesheet Template Inheritance over Layouts apps/views/home/index.jade Startup Institute boston // follow me : @jamiehdavidson
  • 21. + Step 1: Routes AND VIEWS apps/home/routes.coffee Set Page-Specific Variables Set page title and page-specific stylesheet name apps/home/views/index.jade Route-Specific HTML Nothing fancy yet Startup Institute boston // follow me : @jamiehdavidson
  • 22. +STEP 1: Summary Download Node, NPM Install dependencies with ‘npm install’ Install Foundation and use compass to compile scss -> css Use Fonts with typekit and Google Fonts. Load them with Webfont loader create a basic layout with foundation handle a route to the homepage. define a simple view to render Startup Institute boston // follow me : @ jamiehdavidson
  • 23. + Step 2: CLient-side javascript Same rules apply 1. keep it organized (i.e. not a whole bunch of jquery selectors) 2. keep it to as few (minified) files if possible Startup Institute boston // follow me : @ jamiehdavidson
  • 24. + Step 2: asset Pipeline app.js Time for some Rails-like magic npm install connect-assets --save Startup Institute boston // follow me : @jamiehdavidson
  • 25. +STEP 2: Summary Download connect-assets SEtup your directory structure for some rails-like magic one javascript file to rule them all! Startup Institute boston // follow me : @ jamiehdavidson
  • 26. + Step 3: Setting up a database app.js Mongo and Mongoose brew install mongodb npm install mongoose --save Your Mongo Server mongod Mongo Models Require them! Again, no magic Startup Institute boston // follow me : @jamiehdavidson
  • 27. + Step 3: Defining a model’s schema models/users.js apps/users/routes.coffee ✓Define an api for our users ✓No redirects or renders. All json ✓require the route in app.js Startup Institute boston // follow me : @ jamiehdavidson
  • 28. +STEP 3: Summary Download mongo and mongoose define a simple user model and its schema Define a rest api for our users Get ready for angular js Startup Institute boston // follow me : @ jamiehdavidson
  • 29. + Step 4: Gimme some angular assets/js/skill-show.coffee Dependency injection HTML5 Mode assets/js/services.coffee Automatic REST Download angular-resource Beware of minification assets/js/controllers.coffee Initialize and add users Startup Institute boston // follow me : @jamiehdavidson
  • 30. + Step 4: angular in the view apps/home/views/index.jade New scope Create a new user Bind to a dynamic model Display all users Default text when we have no skills Startup Institute boston // follow me : @jamiehdavidson
  • 31. +STEP 4: Summary Create your angular app. reference it with ng-app use $resource for automatic rest communication with a model minification gotcha controllers create a new scope where we create variables and define events/methods remember ng-repeat, ng-model, ng-submit, ng-show....you’ll use them in every app Startup Institute boston // follow me : @ jamiehdavidson
  • 32. + Step 5: Adding skills and searching Add a new skill Bind to new ‘query’ model Filter users based on ‘query’ value A new controller/scope for every user ng-init acts as a scope ‘constructor’ Show only when editing Special Angular form select Toggle the button when we go into ‘edit mode’ Startup Institute boston // follow me : @jamiehdavidson
  • 33. +STEP 5: Summary We can automatically search a collection client-side with one line of angular ng-init is used to initialize a variable in the current scope a controller inside a controller creates a child scope. the 2 scopes can communicate with each other through events use $watch to monitor for changes Startup Institute boston // follow me : @ jamiehdavidson
  • 34. + Step 6: Creating a directive Notice the embedded Angular bindings Directives are probably the most complicated aspect of Angular Startup Institute boston // follow me : @jamiehdavidson
  • 35. + Step 6: routing a one-page app Old apps/home/views/index.jade views/partials/users/index.jade move to change to Startup Institute boston // follow me : @jamiehdavidson
  • 36. + STEP 6: The final conclusion Directives act as ‘widgets’, allowing you to define a unique/complex dom structure for a single dom element the directive documentation kinda sucks ng-class = conditional css classes the $routeprovider acts as a route handler: given a specific url, fetch and render a specific template ng-view defines where the template is rendered templates can contain angular bindings/expressions just like a view watch out for seo with one-page apps/a lot of dom manipulation Startup Institute boston // follow me : @ jamiehdavidson
  • 37. THANK S. FOR YOUR ATTENTION Startup Institute boston // follow me : @jamiehdavidson