From 0b8277f72cdc2ed2abeb566f30958bd8e0dc5167 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Wed, 21 Feb 2018 22:41:20 -0300 Subject: Readme and validation --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 95c842c..16658a9 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ then access [localhost:3000/swagger-ui](http://localhost:3000/swagger-ui/index.h ## Stack -I chose [luminus](http://www.luminusweb.net/) for my stack as it makes the initial setup way easier since it provide a wide range option of configuration for a bunch of technologies. -To bootstrap the project I used `lein new luminus queue-api +swagger +service +kibit` plus datascrypt which doesn't come with Luminus. +I chose [luminus](http://www.luminusweb.net/) for my stack as it makes the initial setup way easier, it provides a wide range profiles for a bunch of technologies. +I bootstrapped the project with `lein new luminus queue-api +swagger +service +kibit` plus datascrypt which doesn't come with Luminus. ### +Swagger @@ -21,15 +21,15 @@ When possible I always add it to a project for it make easier to visualize and t ### +Service -To remove all front end stuff since I didn't need it. +To remove all front end stuff since I don't need it. ### +Kibit -I added because it gives some insight how to make you code more idiomatic. +It gives some insight how to make you code more idiomatic. ### Datascript -I chose [datascript](https://github.com/tonsky/datascript) for its easy setup, after little to no effort I had it working. +[datascript](https://github.com/tonsky/datascript) was chosen for its easy setup, after little to no effort I had it working. Even though it was meant to run on browser it fit nicely in the project, and because it works pretty much like Datomic it has [powerful query system](https://docs.datomic.com/on-prem/query.html) and works seamlessly with clojure. Additionally it had an okay [non-documentation](https://github.com/tonsky/datascript/wiki/Getting-started) with some [samples](https://github.com/kristianmandrup/datascript-tutorial) and if I couldn't find for Datascript I'd search for a Datomic seeing that query system of both are compatible. @@ -70,7 +70,8 @@ Those models wrap up in schema: ### services.clj After all luminus file there is actually two files that have the core logic of the app `services.clj` and `db/core.cljs`. -For `services.clj` it holds all code for endpoint definition and model validation. considering the exercise requirements we gonna need 5 endpoints: +For `services.clj` it holds all code for endpoint definition and input validation. +Considering the exercise requirements there is a need for 5 endpoints: * Endpoint to add agent is a`:put` at `/agent` * Endpoint to get how many jobs of each type this agent has performed is a `:post` at `/agent`. Note: usually since it is a method that doesn't modify anything I'd have used `:get` and pass the agent id via path (`/agent/:id`) but one of the requirement is "*All endpoints should accept and return JSON content type payloads*" I worked with POST PUT. @@ -84,7 +85,7 @@ For model and validation details access swagger-ui. Core.clj holds all logic to interact with Datascrip therefore all the code to manage the queue. The idea behind it is actually simpler than part 1 since Datascrip handle the hard word. -For example, to store jobs and agents I'd simply `transact!` the entire object and we good to go. +For example, to store jobs and agents I'd simply `transact!` the entire object and it is good to go. ```clojure (d/transact! queue-api.db.core/conn @@ -95,7 +96,7 @@ For example, to store jobs and agents I'd simply `transact!` the entire object a :job/status :unassigned}]) ``` -While with a simple query I can fetch the exact piece of information that I need for the moment. +While with a simple query I could fetch the exact piece of information that I need for the moment. ```clojure (d/q '[:find ?d ?id -- cgit v1.2.3