To start your Phoenix server:
- Run
mix setup
to install and setup dependencies - Set database configuration (using postgresql)
username: "postgre_username", password: "postgre_password", hostname: "localhost", database: "database_name",
- Run
mix ecto.migrate
to run migration database - Start Phoenix endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
POST /login
Parameter | Type | Description |
---|---|---|
username |
string |
Required |
password |
string |
Required |
{
"username": "your username",
"password": "your password"
}
POST /register
Parameter | Type | Description |
---|---|---|
email |
string |
Required |
username |
string |
Required |
password |
string |
Required |
{
"email" : "your email",
"username": "your username",
"password": "your password"
}
GET /blog
GET /blog/1
{"Authorization" : "Bearer token"}
POST /api/v1/blog
Parameter | Type | Description |
---|---|---|
title |
string |
Required |
body |
string |
Required |
{
"post": {
"title": "your title here",
"body": "your body here"
}
}
PUT /api/v1/blog/1
Parameter | Type | Description |
---|---|---|
title |
string |
Required |
body |
string |
Required |
{
"post": {
"title": "your title here",
"body": "your body here"
}
}
DELETE /api/v1/blog/1