Coder Social home page Coder Social logo

rackstep's Introduction

RackStep

RackStep is (yet another) micro ruby framework for microservices and web development.

Main goals are:

  • be as simple as possible.
  • keep the source code small.
  • implement only the necessary; no overcomplication.
  • allow easy implementation of microservices.
  • use a pure object-oriented approach, avoiding DSLs and configuration files.

Status

Travis CI Code Climate Coverage Ich CI Gem Version Downloads Gemnasium

License Gitter

Twitter

A quick introduction to RackStep

A quick introduction to RackStep

Source code of the presentation: github.com/mfdavid/rackstep-presentations

Example code

Let's create a simple service that returns the current date and time.

# app.rb
require 'rackstep'
require 'json'

class TimeController < RackStep::Controller
  def process_request
    time_hash = {:time => Time.now}
    response.body = time_hash.to_json
  end
end

class App < RackStep::App
  # Routing all GET requests to "/time" path to the TimeController class.
  add_route('GET', 'time', TimeController)
end
# config.ru
require_relative 'app.rb'

run App

The service will be available at /time path and will return the current date and time in json format.

Dependancies

RackStep is developed and tested with Ruby 2.3.1. The only hard dependency is Rack itself, but there are a few recommended gems:

  • unicorn: fast rack-compatible server that can be used for production.
  • simplecov: a simple way to generate statistics about your unit tests coverage.

How to use RackStep

Make sure you have ruby 2.3.1 installed (ruby --version). If you don't, we recommend you to use rbenv to install it. RackStep may work with older ruby implementations but we always develop and test with the latest Ruby MRI stable version.

Install the bundle gem if you don't have it already: gem install bundle

To create a new application, you may clone one of the following repositories as a starting point example:

A full app example: github.com/mfdavid/rackstep-app-template

A minimum app example: github.com/mfdavid/rackstep-minimum-app-template

Go into the directory you cloned the project and install the dependancies by running: bundle install

Start the application server using any rack-compatible server. For development I recommend using shotgun or rackup. For production, RackStep full app template example is pre-configured to use unicorn.

Running tests

In the main folder of the project, execute: rake test

Open coverage/index.html to see the results.

In the wild (who is using it?)

RackStep still in very early stage of development and testing. Right now there is only one website that was built using it: Ninirc.com

Author

RackStep is developed by Marcio Frayze David - [email protected].

rackstep's People

Contributors

marciofrayze avatar

Watchers

Rudnei Lucas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.