For this lab, you will be creating a backend for a completed frontend application. You will be working on an app called "GAphy" which will display a bunch of Gifs.
The frontend application has full CRUD functionality, your job is to create the backend code to make it functional!
- Fork and clone this repository.
- Change into the new directory.
- Fulfill the listed requirements.
Build out your backed in the backend/
directory.
You must create an API that runs at http://localhost:3000/gifs
. You must have
a few different routes:
- GET
/gifs
which will list out all gifs - POST
/gifs
which will add a new gif and return a list of all gifs - PUT
gifs/:gifId
which will update a gif and redirect to the list of all gifs - DELETE
gifs/:gifId
which will delete a gif and redirect to the list of all gifs
You should have your database set up to store a collection of gifs. Your model should have two attributes:
- a
name
for the name of a gif - a
url
for the url of the gif
If these are named differently, you will have to change the frontend!
You should also set up a seed file to load some default gifs into your database.
We recommend using the Giphy site to get gifs. Use the full URL that has the
.gif
file extension (e.g.
"https://media.giphy.com/media/3o6ozBUuLfzTCngAFi/giphy.gif").
- To start, you'll want to set up all your backend folders and files (think:
db
folder,index.js
file, etc.). - You'll also want to run
npm init
to create apackage.json
file to manage dependencies (e.g.express
). - Set up routes in a controller.
- Once you have your back end running on
http://localhost:3000/gifs
, openindex.html
on the front end to test your routes via the frontend buttons.
You shouldn't need to edit the front-end code. After testing your backend and frontend together, you may have to modify and fix your backend.
- Deploy your backend to Heroku and frontend to GitHub pages.
- Add tagging functionality.
- Add another model to the API.
Take a moment to refamiliarize yourself with the Plagiarism policy. Plagiarized work will not be accepted.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.