Skip to content

erdalturan/Elixir-Phoenix-Rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyApp

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Create User with curl

curl -H "Content-Type: application/json" -X POST \
-d '{"user":{"email":"[email protected]","password":"password"}}' \
http://localhost:4000/api/users \ -c cookies.txt -b cookies.txt

Result

HTTP/1.1 201 Created
server: Cowboy
date: Fri, 04 Oct 2019 13:17:35 GMT
content-length: 139
content-type: application/json; charset=utf-8
cache-control: max-age=0, private, must-revalidate
vary: Origin
access-control-allow-origin: null
access-control-expose-headers: 
access-control-allow-credentials: true
location: /api/users/9

{"data":{"password":"$2b$12$HZAQV6eEY80EYX.2vFy8mewEi.UNXBf61qX7t44MzQbb4HLZp6gQi","is_active":false,"id":9,"email":"[email protected]"}}

Login User with curl

curl -H "Content-Type: application/json" -X POST \
-d '{"email":"[email protected]","password":"password"}' \
http://localhost:4000/api/users/sign_in \ -c cookies.txt -b cookies.txt

Get All Users

curl -H "Content-Type: application/json" -X GET \
http://localhost:4000/api/users \ -c cookies.txt -b cookies.txt

Learn more

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages