This is a full stack React-Rails application that allows users to submit their dogs for adoption and adopt other users' dogs if interested.
https://docs.google.com/document/d/1-1V6f13rlXRBsmCC9mOQy1ugjt6dg_D2nyRX9vIopMU/edit?usp=sharing
https://powerful-headland-48083.herokuapp.com/
bundle install
npm install --prefix client
rails s
npm start --prefix client
rails c
The REST API to the dog-adoption-agency React App is described below.
GET /api/dogs
curl -i -H 'Accept: application/json' http://localhost:9292/api/dogs
HTTP/1.1 200 OK
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
[]
GET /api/dogs/:id
curl -i -H 'Accept: application/json' http://localhost:9292/api/dogs/87
HTTP/1.1 200 OK
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
{}
GET /api/dogs/:id"
curl -i -H 'Accept: application/json' http://localhost:9292/api/dogs/106698383
HTTP/1.1 404 Not Found
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 404 Not Found
Connection: close
Content-Type: application/json
{errors: ["Dog not Found"]}
POST /api/dogs/new
curl -i -H 'Accept: application/json' -d '{}' http://localhost:3000/api/dogs/new
HTTP/1.1 201 Created
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 201 Created
Connection: close
Content-Type: application/json
params.permit(:name, :gender, :breed, :image_url, :size, :age).with_defaults(user_id: session[:user_id], is_adopted: false)
PATCH /api/dogs/:id
curl -i -H 'Accept: application/json' -X PATCH -d 'is_adopted=true, adopted_by=sam234' http://localhost:9292/api/dogs/9
HTTP/1.1 200 OK
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
{is_adopted: true, adopted_by: currentUser}
DELETE /api/dogs/:id
curl -i -H 'Accept: application/json' -X DELETE http://localhost:9292//api/dogs/89
HTTP/1.1 204 No Content
Date: Thu, 16 Sept 2022 12:36:30 GMT
Status: 204 No Content
Connection: close