This project is a simple application that allows you to search for gifs on Giphy and save the search history of the user. To execute this project, you need to follow the steps below.
You need have Node.js installed on your machine and PostgreSQL database.
Follow these steps to get your development environment set up:
-
Create a database on your PostgreSQL server.
-
Create a
.env.local
and.env
file in the root of the project and add the following environment variables or follow the.env.example
file:API_KEY
- API key provided by Giphy.DATABASE_URL
- URL to connection database, with username, password, host, port, and database name.
-
Install dependencies in the root of the project with
npm install
oryarn install
. -
Run
npx prisma migrate dev
to create the database tables. -
Run
npm run dev
oryarn dev
to start the development server.
In this project, we have two API routes:
/api/history
- This route is responsible for returning the search history of the user./api/search
- This route is responsible for searching for gifs on Giphy and saving the search history of the user.