quick start with angular 2 and rails api application
npm install angular-2-rails-starterkit -g
for linux sudo npm install angular-2-rails-starterkit -g
-
Install Angular-CLI
npm install -g @angular/cli
for linuxsudo npm install -g @angular/cli
-
Generate Rails project
rails new PROJECT_NEME --api
-
Install gems
Add to Gemfilegem 'rack-rewrite'
gem 'rack-cors'
gem 'foreman'
togroup :development
then runbundle install
-
**Config
config.ru
in root directory file sould looks like this examplerequire_relative 'config/environment' use Rack::Rewrite do rewrite %r{^(?!.*(api|\.)).*$}, '/index.html' end run Rails.application
-
Inside project folder run starterkit
starterkit -g
-
Strat Server
bundle exec foreman start -f Procfile.dev
-
Generate Production
ng build --prod