Skip to content

Commit

Permalink
add documentation endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Apr 16, 2020
1 parent ee7a7a3 commit e8de104
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# AppApi

To start your Phoenix server:
## Endpoints

* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.setup`
* Start Phoenix endpoint with `mix phx.server`
This API provides the following endpoints:
- GET `/api/login`: signin/login and get a jwt back
- GET `/api/person/info`: get your personal user information
- GET PUT `/api/capture/{idCapture}`: create, update and show a text/capture item
- GET POST`/api/capture`: create a new item and get the list of items
- GET POST `/api/capture{idCapture/timers`: create a new timer linked to an item, list timers for an item
- PUT `/api/capture{idCapture/timers/{idTimer}`: update a timer, i.e. start or stop a timer

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.

Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
## JWT header

## Learn more
Except for the login endpoint, all the requests' header need to contain an `Authorization` jwt value.
This jwt is verified via the pipeline `person`:

* Official website: http://www.phoenixframework.org/
* Guides: https://hexdocs.pm/phoenix/overview.html
* Docs: https://hexdocs.pm/phoenix
* Mailing list: http://groups.google.com/group/phoenix-talk
* Source: https://github.com/phoenixframework/phoenix
```elixir
pipeline :person do
plug AppApi.Plugs.ValidateToken
end
```
The `ValidateToken` function will then send the jwt to the dwyl
authentication service and will returns either a `401` unauthorized response
or the person information when valid.

0 comments on commit e8de104

Please sign in to comment.