Member-only story
Launch your Rails database in under 5 minutes
A step by step tutorial
2 min readJan 3, 2019
This will be strictly instructional, follow this step by step guide to quickly build your backend.
- In your terminal:
rails new APP-NAME --api
- Or add this flag if you have Postgres installed and would like to use it:rails new APP-NAME --database=postgresql —-api
- If you choose to use Postgres, remember to turn Postgres on when you launch your server. - In your terminal:
cd APP-NAME && open Gemfile
, then find and uncommentgem 'rack-cors'
, then add this line of code on the next line:gem 'active_model_serializers'
3. In your terminal:bundle && open config/initializers/cors.rb
, then uncomment the following code and use *
for origins:
4. In your terminal: open config/routes.rb
, then add namespacing and resources:# resources :posts, only: [:index, :create]
is an example for when you have more models.