Dad Jokes app using express
- Make a copy of
.env.sample
as.env
, uncomment and update database and server port env variables. - Install Dependencies using
npm install
- Create a new database in postgres and create a
jokes
table. Referdb.sql
file.- Ensure database name matches the
DB_NAME
env variable.
- Ensure database name matches the
- Run the express server using
nodemon
or directly usingnode index.js
-
Frontend -
localhost:<PORT>
- GET
/
- Home page (Joke Search Page) - GET
/saved.html
- Saved Jokes (Favourite Jokes)
- GET
-
Backend (API) -
localhost:<PORT>/api/v1/jokes
- GET
/search?term=<query>
- Search jokes with term - GET
/saved
- Get saved jokes. - POST
/saved
- Save a new joke.- body: { "joke_id": <joke_id>}
- Accept: application/json
- DELETE
/saved/:joke_id
- Delete saved joke with joke_id
- GET
http://localhost:5600/
http://localhost:5600/api/v1/jokes/saved