https://github.com/yayakyogi/blog-jwt-auth
CRUD Blog with JWT Auth
https://github.com/yayakyogi/blog-jwt-auth
elixir joken pbkdf2 phoenix-framework
Last synced: 5 months ago
JSON representation
CRUD Blog with JWT Auth
- Host: GitHub
- URL: https://github.com/yayakyogi/blog-jwt-auth
- Owner: yayakyogi
- Created: 2024-09-16T08:31:11.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-18T03:24:35.000Z (almost 2 years ago)
- Last Synced: 2025-07-14T21:37:31.403Z (12 months ago)
- Topics: elixir, joken, pbkdf2, phoenix-framework
- Language: Elixir
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CRUD API Blog With JWT Auth
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 with `iex -S mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
## Public API Reference
#### Login
```http
POST /login
```
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `username` | `string` | **Required** |
| `password` | `string` | **Required** |
##### Body Raw
```javascript
{
"username": "your username",
"password": "your password"
}
```
#### Register
```http
POST /register
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `email` | `string` | **Required** |
| `username`| `string` | **Required** |
| `password` | `string` | **Required** |
##### Body Raw
```javascript
{
"email" : "your email",
"username": "your username",
"password": "your password"
}
```
#### Blog (List)
```http
GET /blog
```
#### Blog (Detail)
```http
GET /blog/1
```
## Auth API Reference
#### Headers
```javascript
{"Authorization" : "Bearer token"}
```
#### Blog (create)
```http
POST /api/v1/blog
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `title` | `string` | **Required** |
| `body` | `string` | **Required** |
##### Body Raw
```javascript
{
"post": {
"title": "your title here",
"body": "your body here"
}
}
```
#### Blog (update)
```http
PUT /api/v1/blog/1
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `title` | `string` | **Required** |
| `body` | `string` | **Required** |
##### Body Raw
```javascript
{
"post": {
"title": "your title here",
"body": "your body here"
}
}
```
#### Blog (Delete)
```http
DELETE /api/v1/blog/1
```