README.md in nephos-server-0.1.8 vs README.md in nephos-server-0.1.10
- old
+ new
@@ -13,13 +13,10 @@
- Routing
# TODO
-- Routing
- - improve get with arguments
- - add ressource (elarge urls)
- Database connection
# Start
@@ -50,22 +47,27 @@
In a controller, use:
```ruby
return {status: code}
-return {json: {...}}
+return {status: code, content: "Not today"}
+return {json: {status: "resource created"}, status: 201}
return {plain: "text"}
+return {html: "<html><body><h1>:D</h1></body></html>"}
+return {type: "image/jpeg", content: File.read("images/photo.jpg")}
return :empty
```
## Routing
Like in ``/routes.rb``, you have to route manually the api.
```ruby
get url: "/", controller: "MainController", method: "root" # /
get url: "/add", controller: "MainController", method: "add_url" # /add
+get url: "/add/:url", controller: "MainController", method: "add_url" # /add
get url: "/rm", controller: "MainController", method: "rm_url" # /rm
+get url: "/rm/:url", controller: "MainController", method: "rm_url" # /rm
resource "infos" do
get url: "/", controller: "MainController", method: "root" # generate /infos
end
```