vbrazo / blog_api

A fully-fledged backend Blog API with Phoenix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blog API in Phoenix

This codebase was created to demonstrate a fully fledged backend API with Elixir and Phoenix including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the credo community style guides & best practices.

Installation

To run this project, you will need to install the following dependencies on your system:

To get started, run the following commands in your project folder:

Command Description
cp config/dev.exs.example config/dev.exs creates the project's configuration file
mix deps.get installs the dependencies
mix ecto.create creates the database
mix ecto.migrate run the database migrations
mix phx.server run the application

This is a backend project, you won't be able to go to localhost:4000 and see a Frontend application. You can test the API endpoint using Postman or Insomnia.

Database schema

API Endpoints

Route Controller Action HTTP method
/articles/feed ArticleController feed GET
/articles ArticleController index GET
/articles/:id ArticleController show GET
/articles ArticleController create POST
/articles/:id ArticleController put/patch PUT/PATCH
/articles/:id ArticleController delete DELETE
/articles/:slug/favorite ArticleController favorite POST
/articles/:slug/favorite ArticleController unfavorite DELETE
/comments CommentController index GET
/comments/:id CommentController show GET
/comments CommentController create POST
/comments/:id CommentController put/patch PUT/PATCH
/comments/:id CommentController delete DELETE
/tags TagController index GET
/user UserController current_user GET
/user UserController update PUT
/users UserController create POST
/users/login SessionController create POST
/profiles/:username ProfileController show GET
/profiles/:username/follow ProfileController follow POST
/profiles/:username/follow ProfileController unfollow DELETE

Tests

To run the tests for this project, simply run in your terminal:

mix test

Documentation

To generate the documentation, your can run in your terminal:

mix docs

This will generate a doc/ directory with a documentation in HTML. To view the documentation, open the index.html file in the generated directory.

Style guide

This project uses mix format. You can find the configuration file for the formatter in the .formatter.exs file.

Licensing

MIT © Vitor Oliveira

About

A fully-fledged backend Blog API with Phoenix

License:MIT License


Languages

Language:Elixir 99.8%Language:Dockerfile 0.2%