Class 6

Amanda Rush
2 min readSep 19, 2021

1. If a user attempts to create a resource that already exists — for example, an email address that’s already registered — what HTTP status code would you return?

I would return a 409 status code because it indicates a request conflict with the current state of the resource.

2. Consider a responsive site design that requires a full-width image in all responsive states. What would be the correct way to code this to ensure the page loads the smallest image required to fill the space?

You would use the image tag with the sourceset, width and sizes property or in the case of background images you would use media queries. Using those options allows you to load different images at different breakpoints which ensures that on smaller screens only small images will load.

3. When should you npm and when should you yarn?

Both are relatively similar, but Yarn can fetch and install multiple packages simultaneously whereas NPM will install each package one at a time. I think you would use Yarn if you are trying to install several packages at once.

4. How can you make sure your dependencies are safe?

You should be careful choosing which dependencies to use. When researching them, look at the size of the team working on them, how many downloads they have had and when the last time was that the code base was updated. You also can use tools like npm audit to see which dependencies have vulnerabilities that should be fixed. Updating them to the latest version will install important updates which will help secure the code.

5. What are the differences between CHAR and VARCHAR data types (MySQL)?

CHAR is a fixed length character data type whereas VARCHAR is a variable width character data type. CHAR always uses the same amount of data storage per entry, VARCHAR only uses the amount of space it needs depending on the entries size.

6. How else can the JavaScript code below be written using Node.Js to produce the same output?

--

--