-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oreoluwa Akinniranye
committed
Dec 11, 2015
1 parent
53eb618
commit f5c87f0
Showing
7 changed files
with
154 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
gem 'rack' | ||
|
||
group :development, :test do | ||
gem 'pry' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
GEM | ||
specs: | ||
coderay (1.1.0) | ||
method_source (0.8.2) | ||
pry (0.10.3) | ||
coderay (~> 1.1.0) | ||
method_source (~> 0.8.1) | ||
slop (~> 3.4) | ||
rack (1.6.4) | ||
slop (3.6.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
pry | ||
rack | ||
|
||
BUNDLED WITH | ||
1.10.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Reico Server | ||
|
||
## Inspiration | ||
I've been using the Sinatra framework, as well as the Ruby on Rails framework for a while but I've always loved the way someone or a group of | ||
people come together to build something which ends up making our lives easier. | ||
|
||
I was most fascinated by Sinatra which was built with less than 3000 lines of code with very little baggage and I kept telling myself that if someone else could do it, so can I. | ||
|
||
`Currently, its been configured to only respond with a content type of 'application/json'` | ||
|
||
To define your routes, all you have to do is: | ||
|
||
```ruby | ||
require './dsl' | ||
|
||
class Reico | ||
include DSL | ||
|
||
def root_path | ||
response({data: :amazing}.to_json) | ||
end | ||
end | ||
|
||
Reico.serve do | ||
get '/path', to: "controller#action" | ||
|
||
get '/path2' do | ||
#evaluate path2 here | ||
end | ||
end | ||
``` | ||
|
||
In you `config.ru` you may want to run, depending on the class you are serving from. Mine is from `Reico` | ||
|
||
```ruby | ||
Rack::Handler::WEBrick.run Reico | ||
``` | ||
|
||
There are a lot of implementations that has not been done in this, including security, error handling, testing amongst others, but as they say `Great things starts small` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require './dsl' | ||
|
||
class Reico | ||
include DSL | ||
|
||
PID_FILE = "tmp/pids/server.pid" | ||
|
||
# @@token = [] | ||
|
||
def root_path | ||
response({data: 'Got root url good'}.to_json) | ||
end | ||
|
||
|
||
def request_params | ||
|
||
end | ||
|
||
end | ||
|
||
class Oreoluwa | ||
def action | ||
{kool: :right, awesome: :amazing}.to_json | ||
end | ||
end | ||
|
||
|
||
class Cent | ||
def whatever | ||
{president: :amity, awesome: :cool}.to_json | ||
end | ||
end | ||
|
||
class Kay | ||
def coolio | ||
{jumper: :yeah, kay: :kode}.to_json | ||
end | ||
end | ||
|
||
class Daisi | ||
def yes | ||
{this: :is, it: :yes}.to_json | ||
end | ||
end |