Technical Assessment
SOA Microservices
Intructions
Folders structure
- apis: define paths of apis
- repositories: define mongodb connection
- services: define logics
- common: define supported packages
- models: define structs
- servers: define server to run api
- tmp: include file log of this project
- pkgs: include all third party libraries
Detailed steps to config and run api
You copy .env_example to .env and write approriate configuration data to .env
To save time, I offer use secret key to secure apis.
So I provided secret key, so you only need to pass below field to .env file
SECRET=8HsicGYxLnf9xNmFjF5WuRgu1VHwcktDLQIR6EPMs8kTwJlBgT
# PostgreSQL
PG_HOST=
PG_DATABASE=
PG_USERNAME=
PG_PASSWORD=
PG_PORT=
Notice: you should replace http://localhost:8000 with your domain api when you deployed on your server. If you run 2 curls on your local terminal, please skip this notice.
Run source code
You can run source code on your computer or your server:
go run main.go
this command will exported app.exe file, helping you to deploy.
I also have already created a Dockerfile, you can run to build an image and deploy to the server.
Build Docker file:
docker build --pull --rm -f "Dockerfile" -t soa:latest .
Copyright © 2025 AnhLe. All rights reserved.