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

Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreelreely ones
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsUXDXConf
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 

Recently uploaded (20)

Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 

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