Sha256: 13d82fc651a54fa4c1462e569b609ddbeb9d6ad025977a0b5f2f00b348dd51f2

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

# Nephos Ruby Server

[![GitHub version](https://badge.fury.io/gh/pouleta%2FNephosRubyServer.svg)](http://badge.fury.io/gh/pouleta%2FNephosRubyServer)

[![Gem Version](https://badge.fury.io/rb/nephos-server.svg)](http://badge.fury.io/rb/nephos-server)

[![Code Climate](https://codeclimate.com/github/pouleta/NephosRubyServer/badges/gpa.svg)](https://codeclimate.com/github/pouleta/NephosRubyServer)

This is a simple web server, based on rack and puma, with a minimal help:

- Controllers
- Rendering
- Routing


# TODO

- Improve rendering
  - html support
- Routing
  - improve get with arguments
  - add post and put (like get)
  - add ressource (elarge urls)
- Database connection


# Start

```sh
gem install nephos-server
nephos-generator application MyApp
cd MyApp
nephos-server -p 8080 # port is not required
```


# Documentation

## Controller

To create a controller, simply add it to ``controllers/``.
The basic code of a controller can be generated via ``nephos-generator controller NAME``.

```ruby
class Example < Nephos::Controller
  def root
    return {plain: "index"}
  end
end
```

## Rendering

In a controller, use:

```ruby
return {status: code}
return {json: {...}}
return {plain: "text"}
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"
get url: "/rm", controller: "MainController", method: "rm_url"
```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nephos-server-0.1.4 README.md
nephos-server-0.1.3 README.md
nephos-server-0.1.2 README.md
nephos-server-0.1.1 README.md