You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-75Lines changed: 15 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,10 @@
1
-
# RestApiGenerator
1
+
# Rest Api Generator
2
2
3
-
This gem works as a scaffold to generate an endpoint, it generates:
3
+
This gem helps your to build a Ruby on Rails REST api, using a scaffold generator following the best pratices.
4
4
5
-
<ul>
6
-
<li> Model </li>
7
-
<li> Migration </li>
8
-
<li> Routes (resource) </li>
9
-
<li> Controller </li>
10
-
<li> Spec test of controller </li>
11
-
<li> Factory bot </li>
12
-
</ul>
5
+
## How it works?
13
6
14
-
the commnad its simmilar to the model generator "rails g model model_name attributes", in fact it invokes this generator to genrate the model and migration file
7
+
We use SwitchDreams default way to make controller using RSpec and FactoryBot for testing and use a custom expection to centralize error handle like this article https://medium.com/rails-ember-beyond/error-handling-in-rails-the-modular-way-9afcddd2fe1b
15
8
16
9
## Installation
17
10
@@ -37,70 +30,17 @@ You need to have installed in your application rspec and factory bot
It's possible to add flag in the command to generate an endpoint with a parent
101
-
$ rails g generator table_name attributes --scope father_name
102
-
103
-
the only thing this won't genrate it's the nested routes, but it will generate all the previous files mentioned just liek a scaffold
34
+
### Generate Resource
35
+
```bash
36
+
$ rails g rest-api-generator-resource table_name attributes
37
+
```
38
+
This command will create:
39
+
-**Model and Migration**: Using rails default model generator
40
+
-**Controller**: A controller with index,show,create,update and destroy methods.
41
+
-**Specs for the created controller**
42
+
-**Factory bot factory for created model**
43
+
-**Routes**: with rails resources
104
44
105
45
## Development
106
46
@@ -110,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
110
50
111
51
## Contributing
112
52
113
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rest-api-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rest-api-generator/blob/master/CODE_OF_CONDUCT.md).
53
+
Bug reports and pull requests are welcome on GitHub at https://github.com/SwitchDreams/rest-api-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/SwitchDreams/rest-api-generator/blob/master/CODE_OF_CONDUCT.md).
0 commit comments