Closed tgaff closed 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
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.
Began making changes to lab here: https://github.com/sf-wdi-25/express-intro/pull/1
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.
@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.
Also added file tree here: https://github.com/sf-wdi-25/express-intro/pull/2 That helped tied things together better over there.
The more I think about the switch to $.ajax
the more I like it:
$.ajax
for put/delete anyhow
please also see https://github.com/sf-wdi-25/express-intro