Backend for poetry-frontend. Built for poets and poem enthusiasts, Poetry allows you to view random poems for the serendipity, search for poems and bookmark your favourites. Poetry provides a minimalist UI and allows migrating poems from a local JSON or CSV file.
- Live Site: https://poetry-backend-wv7w.onrender.com (Note: Render free-tier does not have persistent disk, so no changes are stored on sleep. It takes about a min to start up as well.)
- Run
docker pull ghcr.io/younusmz/poetry-backend:latestto pull the docker image. Make a container and run. That's a quick way to spin it up.
- Migrate poems from CSV and JSON to local SQLITE database
- View random poems to find the ones you may have missed
- Search for poems by title
- Boomark your favourite poems
- Responsive UI - Use it on your phone!
Frontend
- React
- TypeScript
- React Bootstrap
Backend
- Node.js
- Express
Database
- SQLITE
Deployment
- Render
This is a full-stack web application with a React frontend that communicates with a REST API built with Express.
- The frontend handles UI and routing
- The backend exposes RESTful API endpoints
- Data is stored in the local SQLITE database
- poems
- id
- title
- poem
- poet
- tags
- isBookmarked
To set up:
- clone the repository:
git clone https://github.com/YounusMZ/poetry-backend.git - move to the project directory:
cd poetry-backend - Install the dependencies: run
npm install
To run:
- Run
npx tscto transpile ts to js. - Run
node server ".\fileName.json"to start the server. - "fileName.json" will be used as a source to migrate data to the database.
- If env.PORT is not set, default port 3000 will be used.
- The build files for poetry-frontend are provided with this repo. You do not need to clone the frontend unless you wish to work on it or run it separately.
Or alternatively,
- run
npm start - looks for "PoetryData.csv" file in the root directory of the project.
{
"id" : string,
"Title" : string,
"Poem" : string,
"Poet" : string,
"Tags" : string | null,
isBookmarked : boolean
}
- Poem
GET api/poem/:idGET api/bookmark/:idPUT api/bookmark/:idGET api/search?poem=poemName&page=pageNumberGET api/randomGET api/favourites?page=pageNumberGET api/poems?ids=poemids
- Worked with react bootstrap and gained more confidence in working with bootstrap. Learned to employ responsive design with bootstrap.
- Released the docker image of the app on GHCR.
- Screenshots:
MIT
The dataset used for the project can be found here.