- This is an API only practice app for an Axios lesson.
- This has an
Eventmodel withname:stringanddescription:stringfields. - This app allows full CRUD on the Event resource.
- This app also includes the Faker gem to seed the database.
git clone https://github.com/sei-eternity/rails-api-app-for-axios-practicecdbundlerails db:create db:migrate db:seedrails s
-
rails new api-only --api -d postgresql --skip-test -
Gemfilegem 'faker' gem 'rack-cors'
-
bundle -
rails g scaffold events name description -
rails db:create db:migrate db:seed -
db/seeds.rb10.times do newEvent = { name: Faker::Coffee.unique.blend_name, description: Faker::Hipster.sentence(5) } Event.create(newEvent) end
-
rails s -
In
config/database.yml, removeusernameandpasswordfromproduction -
git add -A -
git commit -m 'first commit' -
heroku login -
heroku create <NAME-OF-APP> -
git push heroku master -
heroku run rake db:migrate -
heroku run rake db:seed
