Blog backend application is developed using micro service architecture. The project has four micro services, these are Api Gateway, Identity Server, BlogApi Server and Notification Server.
Each micro service has its own repository. You can reach the repositories from here:
The BlogApp
repository has two main folders, one is composes
and another is scripts
.
composes
folder hasdocker-compose
files for micro services and common services like postgresql, rabbitmq etc.scripts
folder hasgit-clone.sh
that clones above repositories andcompile.sh
.
- Run the
compile.sh
script file under the folderBlogApp/scripts
. This will clone all the repositories, build and run them as docker containers. This will also build and run common services defined ininfrastructure.yml
file underBlogApp/composes
folder . - Visit
http://localhost:5000
from your browser and you will gethello world
message.
Before you run compile.sh
, you have to create the following environment variables:
EMAIL_PASSWORD
to store email password.EMAIL_SERVER
your email server name.EMAIL_NAME
your email name.
Register New User:
curl --location --request POST 'http://localhost:5000/api/identity/v1/users/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"phoneNumber": "5656688087",
"password": "xxxxxxxx",
"email": "[email protected]",
"userName": "robi"
}'
User Authentication:
curl --location --request POST 'http://localhost:5000/api/identity/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=blogapp' \
--data-urlencode 'client_secret=xxxxxxxxxxxxxxxxxxxxxxxx' \
--data-urlencode 'scope=blogapi.read profile' \
--data-urlencode 'grant_type=password' \
--data-urlencode '[email protected]' \
--data-urlencode 'password=xxxxxxxxx' \
--data-urlencode 'resposne_type=token'
Test Token Verification:
curl --location --request GET 'http://localhost:5000/api/identity/api/v1/test' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxx......'