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
+30-3
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,23 @@
1
-
## Plain ruby code application
1
+
## Plain ruby code application with Rails taste
2
2
3
-
We usually have to create plain ruby code or microservices using a database dependency. This code is an starting point for this. The magic in this repo consists in including the power of Rake tasks and ActiveRecord library.
3
+
We usually have to create plain ruby code a database dependency. This code is an starting point for this.
4
4
5
-
E.g., whether you need to create an API, you can start with the code in `bin/serve` where you will find a sinatra web endpoint responding the content of a database table.
5
+
The magic in this repo consists in:
6
+
7
+
* You configure your database in a `config/database.yml` file like when you are on Rails.
8
+
* You add your migrations in the folder `db/migrate/` like when you are on Rails.
9
+
* You can add your __seeds__ in the file `db/seeds.rb` like when you are on Rails
10
+
* It includes the power of database Rake tasks for ActiveRecord library so you can run `rake db:migrate` and an automatic `schema.rb` file will be created.
11
+
12
+
BUT you will be using just PLAIN ruby code!
13
+
14
+
### Also, a Microservice starting point
15
+
16
+
Furthermore, whether you need to create an API, you can use this repo as an starting point.
17
+
18
+
In fact, the demo prepared in this repo consists in a web microservice including a __sinatra__ endpoint which will respond with data persisted in the database.
19
+
20
+
Follow next steps to start the web microservice.
6
21
7
22
### Instalation
8
23
@@ -12,6 +27,18 @@ docker-compose run app rake db:create db:migrate
12
27
docker-compose run app rake db:seed
13
28
```
14
29
30
+
#### Run demo
31
+
32
+
Follow the instalation steps and then:
33
+
34
+
```sh
35
+
docker-compose up
36
+
```
37
+
38
+
Open a web browser and visit http://localhost:8888/
39
+
40
+
You will receive a JSON response with the data created throw the `db/seeds.rb` file.
0 commit comments