Cumulative Project: Content Creators Contracting

Hello community.
can someone send me pls the answer for this project, i realy dont understand the instraction for this project, it realy difficult to understand…
If not send me the answer can someone explain me better the insructions and what to do and how…
I wiil appreciate if you’ll see it and help me.
thank you.

1 Like

Hey there!

The short answer is no.

Giving you the complete solution accomplishes nothing. You don’t learn how to build the solution, and if you continue past material that you don’t understand because it’s difficult you’re likely setting yourself up for failure when it comes up again in future.

Coding is hard, and whilst there are probably plenty of people here on the forum who could give you the answers the fact is that if you’re working as a developer there won’t always be someone around to hand you a pre-built solution.

If you are struggling with the project, that suggests you have made an attempt. Post what you’ve done so far, tell us where you got stuck and what about it is troubling you and we’ll help you along. :slight_smile:

1 Like

First of all thank you to answer my qustion and agreed to help me with my problem.
when I asked for the answer I actually asked for example becuase I never seen project like that before and I didnt know how it looks like because they asked us to do something that we never did before.
now, ill’ explain my problem.
my problem is that I dont understand the Implementation Details how do I take a string representing a filename and return the proper content-type extension and how do I implement the functionality for determining content types.
I just need a hint or an advise of how to do it cause so far the codecadamy never gave us project like this.
thank you helping me i’ll appreciate if you help me.
thank you!


The project starter code provides you with a useful code snippet, courtesy of the good folks at Content Creators Contracting:

const extension = filename.match(/.*\.([^\.]*)$/)[1];

They’ve told you that this code will take a filename, and give you its extension. For example, if filename = "my_page.html" then extension will be "html".

The Implementation Detail tells you:

A function called getContentType, which will take a string representing a filename and return the proper content-type extension.

request-logic.js even includes the starting outline of that very function. All you need to do is put the code in the middle.

For example, if we wanted to detect a PDF file, then we’d need to be able to call your function like this:
and get the following back:

The implementation detail tells you the content types you need to handle:

  • 'text/html',
  • 'text/css',
  • 'image/jpeg',
  • and 'text/plain'

These are all very common file types; can you see how you can use the provided starting code to build a function which detects these file types?

If you can't figure it out, here's the basic algorithm. (Don't just click me!)
  1. Your function getContentType(filename) is called.
  2. We use the const extension = ... code provided to get the file’s extension, and store it in the variable extension.
  3. Examine the extension, and see if it corresponds to any of the target file types. For example, if filename was "example.pdf", then extension = "pdf", and a pdf extension means the file is an application/pdf type. (You need to detect the four content types listed in my previous post.)
  4. Return the content type - e.g. application/pdf - which corresponds to the provided file.

There is a test suite, as well as instructions on how to use it, provided with the project. This will allow you to check that your code is working correctly.