reading-notes

Tif Taylor | Code Fellows

View project on GitHub

Class 07 | Express

Video: Express Middleare Explained
Article: Using Express Middleware
Article: Express Middleware
Article: Using Express Routing

Review Tidbits

What’s the difference between PUT and PATCH?

  • PUT gives a new version of the requested source and replaces original, whereas PATCH just gives instructions on how to modify the source

Provide links to 3 services or tools that allow you to “mock” an API for development like json-server

Compare and contrast Swagger and APIDoc.js Which HTTP status codes should be sent with each type of (un)successful API call?

  • 404 Not Found response for an operation that returns a resource by ID, or a 400 Bad Request response in case of invalid operation parameters.
      /users/{id}:
    get:
      summary: Gets a user by ID.
      response:
        200:
          description: OK
          schema:
            $ref: '#/definitions/User'
        401:
          $ref: '#/responses/Unauthorized'   
        404:
          $ref: '#/responses/NotFound'       
    
  • for APIDoc.js: @apiErrorExample {json} Error-Response:

Compare and contrast SOAP and ReST

  • ReST is newer than SOAP and aims to basically do things better that SOAP wasn’t made to encounter originally and makes accessing web services simpler. Both provide a set of rules in an architecture which is helpful. Choosing one becomes more obvious based on the language you’re programming in.

Document the following Vocabulary Terms
Term | Defition
–|–
SOAP | “Simple Object Access Protocol” / invented by MS, been around a while. XML msging service ReST Verbs | GET (obtain data), POST (send new data), PUT (modify data), DELETE (remove data) CRUD Verbs | CREATE, READ, UPDATE, DELETE Swagger | Swagger is in essence an Interface Description Language for describing RESTful APIs expressed using JSON. Swagger is used together with a set of open-source software tools to design, build, document, and use RESTful web services. Swagger includes automated documentation, code generation, and test-case generation resource

Upcoming Lecture

Which 3 things had you heard about previously and now have better clarity on? 1) Middleware. I’ve heard this team but haven’t understand at all. Slowly getting better idea. 2) Application level use of middleware, think we did this in 301? 3) body parser. We used this in 301 but didn’t understand it’s relation to middleware

Which 3 things are you hoping to learn more about in the upcoming lecture/demo? 1) Don’t understand the use or point etc of router-level middleware 2) Not clear on app.use() or the concept of “middleware as a callback fn” 3) URL paths and regex

What are you most excited about trying to implement or see how it works?

  • ReST routing with Express? I’m not sure if we’re doing ReST with Express or not

Back to Home