Coder Social home page Coder Social logo

elixir-plug-rest-boilerplate's Introduction

Elixir Plug Boilerplate

This is a basic boilerplate for building rest applications with Elixir/Plug

Installation

To install it, you need to clone this repository or download it.

  1. Make sure you have elixir installed
  2. Run the command below
    git clone --depth=1 https://github.com/imhassane/elixir-plug-rest-boilerplate.git <YOUR_PROJECT_NAME>

The project has already some dependencies required by default.
The mix.exs file dependencies looks like this:

def deps do
  [
    {:plug_cowboy, "~> 2.0"},
    {:jason, "~> 1.2"}
  ]
end

Configuration

All the configurations required can be changed in the config directory depending on the environment.
For the routes and Plug configuration, you can edit the lib/routes/base.ex file. This file is responsible for returning responses in the correct format and status.
By default, you can send response either with standard http codes such as 200 or 404 or you can use atoms defined in the same file such :not_found which will be converted to 404 or :ok which will be converted to 200.

Tutorial: Building a movie api with the boilerplate

I've written a story on medium on how to build and test an api with the boilerplate. See the full article here

elixir-plug-rest-boilerplate's People

Contributors

imhassane avatar goneri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.