Meme Stream Page where users can post memes by providing their name, a caption for the meme and the URL for the meme image as input.
- HTML
- CSS
- Vannila Javascript
- Bootstrap 5
- Material UI
- MySQL
- Java 8
- Spring Boot v2.4.2
- Hibernate
- Swagger
- Lombok
- Mockito
- JUnit 5
- First clone the repository using the following command:
git clone https://github.com/harikesh409/xmeme.git
- Change the current directory to the backend directory of the clone repo.
cd xmeme/backend/XMeme/
- Run the backend server using maven.
mvnw spring-boot:run
- Running using docker-compose.
docker-compose up -d
- By default the application will run on port 8081.
- Get all Memes - GET Method
The pagenumber and pagesize parameters are optional.
http://localhost:8081/memes?pageNumber=0&pageSize=100
CURL example:
curl --location --request GET 'http://localhost:8081/memes'
- Get Meme by ID - GET Method
Pass the meme id in the url.
http://localhost:8081/memes/id
CURL example:
curl --location --request GET 'http://localhost:8081/memes/1'
- Add Meme - POST Method
Pass name, url, and caption on request body as json.
http://localhost:8081/memes
CURL example:
curl --location --request POST 'http://localhost:8081/memes' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "xyz",
"url": "https://ichef.bbci.co.uk/images/ic/704xn/p072ms6r.jpg",
"caption": "This is a meme"
}'
- Update a Meme by ID - PATCH Method
Pass meme id in the url and caption, url in request body as json.
http://localhost:8081/memes/id
CURL example:
curl --location --request PATCH 'http://localhost:8081/memes/1' \
--header 'Content-Type: application/json' \
--data-raw '{
"caption":"updated caption",
"url":"https://images.pexels.com/photos/3573382/pexels-photo-3573382.jpeg"
}'
- Delete a Meme by ID - DELETE Method
Pass meme id in the url.
http://localhost:8081/memes/id
CURL example:
curl --location --request DELETE 'http://localhost:8081/memes/1'
- Swagger UI
http://localhost:8081/swagger-ui/
- Goto
\xmeme\frontend
and openindex.html
. - To change the backend URL update the
host
variable inscript.js
file located at\xmeme\frontend\js
.
// Change this value to update the backend URL
const host = "http://localhost:8081";