Changelog
8 september 2023, Baku Azerbaijan
Initial version with service-lib@service-v0
24 october 2023, Ho Chi Minh City, Vietnam
Proxy was replaced with service-lib@proxy-v0
This is the demonstration of SDS framework!
Its intention is to see that service creation works, proxies are running.
The idea of the app is a todo list for a one user. The user may add items into the todo list. Once the task is done, it's removed from the list.
The app is consisted of the three parts.
- Frontend – A web page written in Next.js.
- Web proxy – A web proxy to enable backend over http protocol.
- List proxy – A proxy that returns the task list after Add and Done.
- Backend – A backend written in SDS Framework.
The backend is an API with the three routes.
Command | Request Parameters | Reply Parameters | Description |
---|---|---|---|
add | "title", "description" | "number" | Adds a new task into todo list |
done | "number" | Removes the task from todo list | |
list | Array<"title", "description", "number"> | Returns all the tasks that needs to be done! |
Receive the message.Request from frontend in HTTP protocol. The proxy forwards request to the destination in ZMQ protocol. The result from the backend is replied back to the frontend.
It over-writes the replies.
For Done and Add, it fetches from backend the data using List
.
For all other commands, simply returns as it is.
It's a single page website that shows the todo list.
At the top, it has a button to add a new tasks. Click on the button opens a New task modal.
In the list, all the tasks are represented as the card. The card has a title, description and a "done" button. Click on the button sends a request to the backend. After a successful reply, the website removes the card from the todo list.
All diagrams available on Source
Main page, calls list
route from backend.
The modal popup when clicked to the New button.
Compile the backend
:
go build -o ./bin/test.exe
The backend comes with the pre-generated configuration.
This app configuration is stored in ./backend/bin/app.yml
.
If the backend binary stored in the same directory, then the app will load app.yml
automatically.
You may delete that to automatically generate a new configuration.
Any service requires its id and url.
If you use app.yml
, then call the app with:
./bin/test --id=todaydo --url=github.com/ahmetson/today-do
Compile the cli
.
Remember the manager port and handler port from app.yml.
Run it on another terminal.
Make sure that you run the backend first.
Port 57397
is the manager.
Port 57398
is the manager.
./bin/test --port=57397 --cmd=close
– close the service../bin/test --port=57398 --cmd=add
– add a new task../bin/test --port=57398 --cmd=done --number=1
– delete the task by its order number../bin/test --port=57398 --cmd=list
– returns all tasks.
The proxy has a Postman collections.
If you use custom generated backend/bin/app.yml
, then change the port in the postman collection.