Api-beop is a web api based on Ring and Compojure. State management is done with Component library Counter status are stored in a Datalevin database used in a as kv-store Data are stored with a transaction process.
I used way to manage component as recommended in this book
- (user/go) to start the system
- (user/reset) to restart the system
- (user/stop) to stop it.
clj -X:run
Port can be configure in the conf/dev.edn
or conf/dev.edn
file.
All routes return a JSON structure.
Example: curl -X GET http://localhost:3000/question-data?advert-id=1
Data are store in the def var name data
, for the moment in the core
namespace
{
"body": {
"accessibility": {
"label": "Accessibility"
},
"inclusivity": {
"label": "Inclusivity"
},
"adjustability": {
"label": "Adjustability"
}
}
}
Example: curl -X POST http://localhost:3000/count-click?advert-id=1&vote-id=accessibility
{
"new-count": 26,
"transaction-status": "transacted",
"params": {
"advert-id": "1",
"vote-id": "accessibility"
}
}
Example: curl -X GET http://localhost:3000/advert-campaign-status?advert-id=1
{
"result": {
"accessibility": 26,
"inclusivity": 7,
"adjustability": 6
},
"params": {
"advert-id": "1"
}
}
- Check the validity of the options sent by the client with spec
- Make some tests
- Add the adverts data in a database
- Manage exceptions for DB
- Manage exceptions for webserver
- Improve organization (routes namespace is not nice)