Skip to main content

Get working!

Get started on your API.

Start with a basic express server that has a "/" route that returns the server status.

Then add a variable that will contain the data for your API. This variable should be an array of objects. Each object should represent a single item in your collection. Each object should have an id property that is a unique number and a name property that is a string.

tip

You might want to reuse the same data from your previous project.

Finally, create the following routes (changing items to the name of your collection):

  • GET /items - returns the entire collection
  • GET /items/:id - returns a single item
  • POST /items - adds a new item to the collection
  • PUT /items/:id - updates an item in the collection
  • DELETE /items/:id - deletes an item from the collection