sf-wdi-25 / notes

3 stars 22 forks source link

W03 d03 dawn express intro #30

Closed tgaff closed 8 years ago

tgaff commented 8 years ago

please also see https://github.com/sf-wdi-25/express-intro

nathanallen commented 8 years ago

Important to keep a clear distinction between public vs. server files to avoid confusing students. Here's the structure I'd recommend:

├── server.js  // let's avoid `app.js`
├── package.json
├── public  // i.e. client-side
│   ├── images
│   ├── javascripts
│       └── app.js
│   └── stylesheets
│       └── style.css
│   └── vendor // e.g. bower_components
└── views
│   ├── index.html
nathanallen commented 8 years ago

Might be interesting to combine $.ajax with method chaining:

$.ajax({
           method: 'GET',
           url: 'http://localhost:3000/api/albums'
  })
 .success(function(data){
    console.log(data)
  })
 .error(function(){
    console.log('uh oh')
  });

(I note jQuery does this in their ajax documentation).

Either way, probably want to avoid using e for the error callback. I don't want them confusing it with the event-object.

nathanallen commented 8 years ago

Began making changes to lab here: https://github.com/sf-wdi-25/express-intro/pull/1

tgaff commented 8 years ago

In terms of chaining we should just do one or the other. Which do you guys ( @justincastilla and @nathanallen ) prefer?

I think I need to make adjustments in Monday's lecture as well depending on this decision.

tgaff commented 8 years ago

@nathanallen I added your file decoder-ring. That's always a bit tricky for them. I'll need to make an adjustment to move index.html into views. I'm asking them to move the files into public and views.

tgaff commented 8 years ago

Also added file tree here: https://github.com/sf-wdi-25/express-intro/pull/2 That helped tied things together better over there.

nathanallen commented 8 years ago

The more I think about the switch to $.ajax the more I like it: