Skip to content

chatgut/postService2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Application - post service

Application for posting and reading messages

Application is running on port 8000
Together with a mongodb instance

Getting started

To run in docker containers via a network called mynetwork:
docker network create mynetwork
docker run -p 27017:27017 --name mymongo --network-alias mymongo --network mynetwork -d mongo:latest
docker run -d --name postservice --network-alias postservice --network mynetwork -p 8000:8000 jonathanjonathan001/postservice:latest

Docker image is available on
https://hub.docker.com/r/jonathanjonathan001/postservice
docker pull jonathanjonathan001/postservice:latest

Endpoints

Endpoint: POST /posts

JSON format for POST:
{
"fromUsername": "kalle",
"toUsername": "martin",
"message": "This is a message"
}

Endpoint: GET /posts

To do a GET request the format on the URL should be:
http://hostname:8000/posts?toUsername=touser&page=0&nMessages=numberofmessages
And there should be a sender in the http header named userID
hostname should be postservice
touser should be the username of the recipient
numberofmessages should be the desired number of messages to get

This is the format of the JSON that comes back from the request:
{
"id": "645ceefe5423974b37a6d061",
"fromUsername": "jonathan",
"toUsername": "martin",
"message": "This is a message",
"dateAndTime": "2023-05-11T13:34:54.105117379"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published