File tree Expand file tree Collapse file tree 7 files changed +31
-25
lines changed
Expand file tree Collapse file tree 7 files changed +31
-25
lines changed Original file line number Diff line number Diff line change 1+ procfile: Procfile.dev
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ gem 'devise_token_auth'
3232group :development , :test do
3333 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
3434 gem 'byebug' , platform : :mri
35+ gem 'foreman'
3536end
3637
3738group :test do
Original file line number Diff line number Diff line change 5959 faker (1.7.3 )
6060 i18n (~> 0.5 )
6161 ffi (1.9.18 )
62+ foreman (0.82.0 )
63+ thor (~> 0.19.1 )
6264 globalid (0.3.7 )
6365 activesupport (>= 4.1.0 )
6466 i18n (0.8.1 )
@@ -165,6 +167,7 @@ DEPENDENCIES
165167 devise_token_auth
166168 factory_girl
167169 faker
170+ foreman
168171 jsonapi-resources
169172 listen (~> 3.0.5 )
170173 pg (~> 0.18 )
Original file line number Diff line number Diff line change 1+ web: bundle exec puma -p 3001
2+ webpack: cd client && npm start
Original file line number Diff line number Diff line change 1- # README
1+ # [ rails-json-api-react ] ( https://github.com/tb/rails-json-api-react )
22
3- ## Rails API app setup
3+ ## [ DEMO ] ( rails-json-api-react.herokuapp.com )
44
5- rails new . -d postgresql --skip-javascript --api -T
5+ Demo user: user1@example.com / Secret123
66
7- ## jsonapi-resources setup
7+ ## Setup app
88
9- ### Models
9+ bundle
10+ rake db:setup
11+ cd client && npm i
1012
11- rails g model category name:string
12- rails g model post title:string body:text category:references
13- rails g model comment body:text post:references
14-
15- ### Resources
13+ ## Start app
1614
17- rails generate jsonapi:resource category
18- rails generate jsonapi:resource post
19- rails generate jsonapi:resource model
15+ foreman start
16+ open http://localhost:3000
2017
21- ### Controllers
18+ ## Adding new JSON API resource
2219
20+ rails g model category name:string
21+ rails generate jsonapi:resource category
2322 rails g controller Category --skip-assets
24- rails g controller Posts --skip-assets
25- rails g controller Comments --skip-assets
2623
27- ### Routes
24+ ### routes.rb
2825
2926 jsonapi_resources :categories
30- jsonapi_resources :posts
31- jsonapi_resources :comments
3227
33- ### Start app
34- foreman start
28+ ### Client
29+
30+ Add list, edit and form components in ` client/src/components/ ` based on one of existing.
Original file line number Diff line number Diff line change @@ -44,11 +44,12 @@ module.exports = removeEmpty({
4444
4545 devServer : ifDevelopment ( {
4646 host : '0.0.0.0' ,
47- port : 8080 ,
47+ port : 3000 ,
48+ overlay : true ,
4849 stats : 'normal' ,
4950 proxy : {
5051 '/**' : {
51- target : 'http://localhost:3000 ' ,
52+ target : 'http://localhost:3001 ' ,
5253 } ,
5354 }
5455 } ) ,
Original file line number Diff line number Diff line change 88
99FactoryGirl . find_definitions
1010
11- FactoryGirl . create_list ( :category , 15 , :with_posts )
11+ 15 . times do |n |
12+ FactoryGirl . create ( :category , :with_posts )
13+ end
1214
131525 . times do |n |
14- User . create ( email : "user#{ n } @example.com" , password : 'Secret99 ' , confirmed_at : Time . now )
16+ User . create! ( email : "user#{ n } @example.com" , password : 'Secret123 ' , confirmed_at : Time . now )
1517end
You can’t perform that action at this time.
0 commit comments