Quiz

  1. What did you mean by 'the action attributes above are pedagogical fibs'?

    I just meant that they were hypothetical examples, not endpoints of some existing app.

  2. Sorry, could you explain the relationship between Express and Get/Post again?

    No need to apologize. This is new for all of us.

    Express parses incoming web requests and puts the data in convenient data structures for us. (I didn't talk about that, but it does.) It then transfers control to one of our handler functions, depending on the endpoint.

    It turns out, for many reasons, there are two kinds of web requests: GET and POST. (Actually, there are 9, but GET and POST are the only ones that we can use the the method attribute of a form, so they cover 99% of all web requests.)

    So, when Express gets a request, it uses both the endpoint and the method to choose the handler.

    It occurs to me that this part of the reading could be clearer and more comprehensive. I'll put that on my to-do list. Thanks for this question.

  3. You mentioned that if resubmitting is harmless, don't use POST - what would be generally used instead?

    GET, since that's the only other option.

    We use GET for reading data, like searching, etc.

    We use POST for updating data, like posting a picture or comment, etc. There's a reason it's called POST.

  4. Does POST return anything (i.e. does it return the item that we updated?)

    It depends entirely on the back-end, meaning us.

    We could return a brand new web page, we could return the same web page we were on when we POSTed, we could return almost nothing at all, we could return a copy of the data that was posted, ...

  5. Do caches happen automatically?

    Browser caches do, yes. Cuz everyone wants them.

  6. Sometimes when I have computer problems like webpages not loading, I'm advised to clear my cache and try again. Can caches store data that can interfere with normal computer activity?

    Yes! Well, with normal web activity. As we'll learn after the break, caches can store cookies, which are used in authentication and sessions.

    If you're having trouble with a website, it can be useful to clear those out, essentially forcing it to forget you and start all over again.

  7. I feel relatively clear on the readings / I think this reading makes slightly more sense than the other one.

    Great!