Skip to content
KTI - Keep This Info
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
env
resources
scripts
src/clj/kti
test/clj/kti/test
.gitignore
.travis.yml
Capstanfile
Dockerfile
Procfile
README.org
profiles.clj.example
project.clj

README.org

KTI - Keep This Info

work in progress

_generated using Luminus version “3.10.40”_

KTI is a small app to learn web programming in clojure.

It is a backend to make it easy to capture things you want to check later.

Example

A (test) live server is available at 159.65.192.68. Here is an example of usage:

Let’s ask for a token to authenticate ourselves:

curl -H 'Content-Type: application/json' --data '{"email": "<your-email>"}' 159.65.192.68/api/token

Go to your email and find you token. Then use it to captured a new reference:

curl -H 'Content-Type: application/json' -H 'Authorization: TOKEN <token>' --data  @- 159.65.192.68/api/captured-references <<EOF
{
    "reference": "search for book to learn git"
}
EOF
{
  "id": 1,
  "reference": "search for book to learn git",
  "created-at": "2019-03-25T19:00:29",
  "classified": false
}

Now when you have time, get to your sofa and classify this reference into an article so you don’t forget what you thought:

curl -H 'Content-Type: application/json' -H 'Authorization: TOKEN <token>' --data @- 159.65.192.68/api/articles <<EOF
{
    "id-captured-reference": 1,
    "description": "Read the git book",
    "action-link": "https://www.google.com/search?client=firefox-b-d&q=git+book",
    "tags": ["programming", "git", "book"]
}
EOF
{
  "id": 1,
  "description": "Read the git book",
  "tags": [
    "book",
    "programming",
    "git"
  ],
  "action-link": "https://www.google.com/search?client=firefox-b-d&q=git+book",
  "id-captured-reference": 1
}

Check all your captured references to check whether you missed something

curl -H 'Authorization: TOKEN <token>' 159.65.192.68/api/captured-references | jq
[
  {
    "id": 1,
    "reference": "search for book to learn git",
    "created-at": "2019-03-25T19:00:29",
    "classified": true
  }
]

And check that it is classified now true!

You found some time and started to read the book! let’s record this and start a review.

curl -H 'Content-Type: application/json' -H 'Authorization: TOKEN <token>' --data @- 159.65.192.68/api/reviews <<EOF
{
    "id-article": 1,
    "status": "in-progress",
    "feedback-text": "First pages of The Git Book - looks promising"
}
EOF
{
  "id": 1,
  "id-article": 1,
  "feedback-text": "First pages of The Git Book - looks promising",
  "status": "in-progress"
}

And after a week you gave up because the book was not that interesting. Let’s just discard this entry.

curl -XPUT -H 'Content-Type: application/json' -H 'Authorization: TOKEN <token>' --data @- 159.65.192.68/api/reviews/1 | jq <<EOF
{
    "id-article": 1,
    "status": "discarded",
    "feedback-text": "After reading 20 pages in a week, I give up."
}
EOF
{
  "id-article": 1,
  "status": "discarded",
  "feedback-text": "After reading 20 pages in a week, I give up."
}

Prerequisites

You will need [https://github.com/technomancy/leiningen][Lein] 2.0 or above installed.

Running

To start a web server for the application, run:

lein run

Developping/nrepl

I usually develop with nrepl + emacs [cider + lispy]. My entrypoint usually is:

  1. Start a headless nrepl server.
  2. Connect to it used cider-connect.

To achieve this I do the following:

cp ./profiles.example ./profiles
lein with-profile +cider-nrepl,+lispy trampoline repl :headless :port 7000
# Inside emacs: M-x cider-connect <RET> <RET>

The profiles.clj set two profiles, cider-nrepl and lispy, each of which adds the necessary dependencies/plugins for cider and lispy.

License

Copyright © 2019 Vitor Quintanilha Barbosa (vitorqb@gmail.com)

You can’t perform that action at this time.