- This is an API only practice app for an Axios lesson.
- This has an
Event
model withname:string
anddescription:string
fields. - 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-practice
cd
bundle
rails db:create db:migrate db:seed
rails s
-
rails new api-only --api -d postgresql --skip-test
-
Gemfile
gem 'faker' gem 'rack-cors'
-
bundle
-
rails g scaffold events name description
-
rails db:create db:migrate db:seed
-
db/seeds.rb
10.times do newEvent = { name: Faker::Coffee.unique.blend_name, description: Faker::Hipster.sentence(5) } Event.create(newEvent) end
-
rails s
-
In
config/database.yml
, removeusername
andpassword
fromproduction
-
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