Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

88 lines (50 sloc) 1.934 kB

DynamoDemo

A simple dynamo application.

It is an example of simple Dynamo application, which:

  • handles GET requests
  • uses callbacks
  • sets custom headers
  • uses parametrized routes
  • sets custom status code
  • sends files
  • generates JSON using exjson
  • serves content from the "public" directory at /public

Live app

This example app is also deployed to Heroku.

How to run it locally

  1. Get Elixir. Beware that Dynamo depends on currently unstable Elixir 0.7.0.dev. If you're on Mac and are using Homebrew to manage packages, install the most recent Elixir with:

    $ brew install erlang && brew install https://raw.github.com/gist/3443774/bef740467d6811dd5e0693fdf666ed8cb48b63c6/elixir.rb --HEAD

  2. Clone this repo:

    $ git clone https://github.com/goshakkk/dynamo_demo.git && cd dynamo_demo

  3. Run server:

    $ elixir --no-halt -S mix run "DynamoDemo.start"

  4. That's it. The app is now running at localhost:3000.

How to run it on Heroku

  1. Create new Heroku Elixir app:

    $ heroku create --buildpack "https://github.com/goshakkk/heroku-buildpack-elixir.git"

  2. Push it:

    $ git push heroku master

    It will take some time to deploy, normally 1-2 minutes.

  3. Access it:

    $ heroku open

API

The app implements very simple API

GET /

Responds with blank JSON object.

GET /version

Responds with JSON object containing version key with value of DynamoDemo.version.

GET /readme

Responds with plain text contents of this README.md file.

GET /hello

Responds with JSON greeting the world.

GET /hello/:name

Responds with JSON greeting name.

GET /restricted

Responds with status code 451 Unavailable For Legal Reasons.

License

Released under the MIT license.

Jump to Line
Something went wrong with that request. Please try again.