Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/smddzcy/simple-phoenix-rest-api

Start point for a simple Phoenix REST API.
https://github.com/smddzcy/simple-phoenix-rest-api

elixir elixir-lang elixir-programming-language json-api phoenix rest rest-api

Last synced: 8 days ago
JSON representation

Start point for a simple Phoenix REST API.

Awesome Lists containing this project

README

        

# Simple Phoenix REST API

Start point for a simple Phoenix REST API. Project includes a ready-to-use `/posts` endpoint, which is generated by `mix phoenix.gen.json`.

## Example Requests with CURL

### List

```
curl http://localhost:4000/posts
```

### Create

```
curl -X POST \
-H "Content-Type: application/json" \
-d '{"post": {"title":"Post Title","content":"Post Content"} }' \
http://localhost:4000/posts
```

### Show

```
curl http://localhost:4000/posts/{id}
```

### Update

```
curl -X PUT \
-H "Content-Type: application/json" \
-d '{"post": {"title":"New Title","content":"New Content"} }' \
http://localhost:4000/posts/{id}
```

### Delete

```
curl -X DELETE \
http://localhost:4000/posts/{id}
```

## Development

To start your Phoenix app:

* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.create && mix ecto.migrate`
* Start Phoenix endpoint with `mix phoenix.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.

## Production

[Check the deployment guides](http://www.phoenixframework.org/docs/deployment) to run in production.

## Learn more

* Official website: http://www.phoenixframework.org/
* Guides: http://phoenixframework.org/docs/overview
* Docs: https://hexdocs.pm/phoenix
* Mailing list: http://groups.google.com/group/phoenix-talk
* Source: https://github.com/phoenixframework/phoenix