nephos-server 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/nephos-server/routing/execute.rb +1 -1
- data/lib/nephos-server/routing/load.rb +15 -0
- data/version +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6614ca080db76bc887198e14fbbc3fa3ef84f0dd
|
4
|
+
data.tar.gz: 60be81fc08845a9849e950454b9f58301a866e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08eba5967d682ab43a0fd4448d21cfa6727d3ecbd3bc1538ff7b6ab60de04aedce8d79d49ea0a1e54e5f53909220806540c15784c916d3eba9b01ba336448a3f
|
7
|
+
data.tar.gz: b258e7da003700bc8e1e8fec72806126b12cb334bfd1f14e20fe38edd8d6e5d338541162659e3d6ba47e21d3d1ab4e79b9c61af004430d75adef4cf2ee10b3fc
|
data/README.md
CHANGED
@@ -19,7 +19,6 @@ This is a simple web server, based on rack and puma, with a minimal help:
|
|
19
19
|
- html support
|
20
20
|
- Routing
|
21
21
|
- improve get with arguments
|
22
|
-
- add post and put (like get)
|
23
22
|
- add ressource (elarge urls)
|
24
23
|
- Database connection
|
25
24
|
|
@@ -65,7 +64,10 @@ return :empty
|
|
65
64
|
Like in ``/routes.rb``, you have to route manually the api.
|
66
65
|
|
67
66
|
```ruby
|
68
|
-
get url: "/", controller: "MainController", method: "root"
|
69
|
-
get url: "/add", controller: "MainController", method: "add_url"
|
70
|
-
get url: "/rm", controller: "MainController", method: "rm_url"
|
67
|
+
get url: "/", controller: "MainController", method: "root" # /
|
68
|
+
get url: "/add", controller: "MainController", method: "add_url" # /add
|
69
|
+
get url: "/rm", controller: "MainController", method: "rm_url" # /rm
|
70
|
+
resource "infos" do
|
71
|
+
get url: "/", controller: "MainController", method: "root" # generate /infos
|
72
|
+
end
|
71
73
|
```
|
@@ -20,23 +20,38 @@ module Nephos
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def route_prefix
|
24
|
+
@route_prefix ||= []
|
25
|
+
File.join(["/"] + @route_prefix)
|
26
|
+
end
|
27
|
+
|
23
28
|
# @params: what [Hash]
|
24
29
|
def get what
|
30
|
+
what[:url] = File.expand_path File.join(route_prefix, what[:url])
|
25
31
|
Nephos::Route.check!(what)
|
26
32
|
Nephos::Route.add(what, "GET")
|
27
33
|
end
|
28
34
|
|
29
35
|
# @params: what [Hash]
|
30
36
|
def post what
|
37
|
+
what[:url] = File.join(route_prefix, what[:url])
|
31
38
|
Nephos::Route.check!(what)
|
32
39
|
Nephos::Route.add(what, "POST")
|
33
40
|
end
|
34
41
|
|
35
42
|
# @params: what [Hash]
|
36
43
|
def put what
|
44
|
+
what[:url] = File.join(route_prefix, what[:url])
|
37
45
|
Nephos::Route.check!(what)
|
38
46
|
Nephos::Route.add(what, "PUT")
|
39
47
|
end
|
40
48
|
|
49
|
+
def resource(name, &block)
|
50
|
+
@route_prefix ||= []
|
51
|
+
@route_prefix << name
|
52
|
+
block.call
|
53
|
+
@route_prefix.pop
|
54
|
+
end
|
55
|
+
|
41
56
|
load 'routes.rb'
|
42
57
|
puts
|
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nephos-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poulet_a
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nomorebeer
|