Cumulative Project: Content Creators Contracting SOLUTION!

This is a solution to the very little guidance that the project gives you. after spending time looking at the project and being annoyed here is a guide to all those that are also annoyed with this project.


  • Once you have downloaded GitBash and Visual Studio Code and Node.js. You are going to download the zipped folder that is provided for the project. I download it to my desktop for easy access and I also unzip it to my desktop. Once all is said and done
  • Open your VS Code and Open the folder that you just unzipped.
  • Within Visual Studio access the terminal ( If you click the blue bar at the bottom of Visual Studio you should be able to to see the terminal tab.)Make sure you are using GitBash as your terminal.
    -Once Terminal is up type in npm install after that runs type in npm test.
    -You should see a couple of failed tests

    It should look like the above
  • Next open up the index.html file in your browser by clicking and dragging it to your browser.

You should notice that there is a empty screen that is because with HTML and CSS they must comunicate. For this within your HTML file we need to link the CSS file. to do this type in the following into your HTML file just below <title>Content Creators</title>:

<link rel="stylesheet" href="css/style.css">

Click Ctrl + S to save the HTML file. you will notice that once you go back to your browser and refresh the page of the index.html file you opened. It changes color.

Now that this is done we will be going back to the project at hand! Looking at the termial (Image above) We are going to be fixing these errors.
So the test that we ran knows that there is a function called getContentType() but it says that we should return different file names. If we look over to the left of Visual Studio Code there are files that we can access. The one that we need is in the “js” folder named “request-logic.js”

You should see this once you open the file

This is where that function is located. We just need to return the following files

In the above screenshot it is telling you that you need to return the file underTHE CONDITION that it ends with the specified file type. We know at this point that coding in JS with conditions you can use if/else statements or switch cases. In this instance I am going to be typing in if/else statements.

This is how I wrote the code. Now if you save the file that you finished typing in and refresh your browser you should see all the updates to the webpage.

function getContentType(filename) {
  const extension = filename.match(/.*\.([^\.]*)$/)[1];
  if(extension === 'html'){
    return 'text/html';
  else if (extension === 'css'){
    return 'text/css';
  else if (extension === 'jpg' || extension === 'jpeg'){
    return 'image/jpeg';
  return 'text/plain';

Hope this helps!
Let me know what yall get!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.