tiny

Version, currently master branch1 version
  • master branchlatestAug 16, 2017

github.com/molovo/tiny

A Crystal module to help you build multi-threaded HTTP micro-services

3 stars
1 dependent
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  tiny:
    github: molovo/tiny
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.22.0
License
MIT
Author
James Dinsdale

Dependencies

Runtime Dependencies

  • herd*github: molovo/herd
  • crayon*github: molovo/crayon
  • dotenv*github: gdotdesign/cr-dotenv

README

tiny

A simple wrapper around HTTP::Server for building CORS-enabled, multi-threaded HTTP micro-services in Crystal.

Installation

Add this to your application's shard.yml:

dependencies:
  tiny:
    github: molovo/tiny

Usage

require "tiny"

# Create the handler for incoming requests
serve do |request, response|
  # This block will only be run on GET requests
  request.get do
    response.json({
      "message"   => "The server is up and running",
      "timestamp" => Time.now.to_s,
    })
  end

  # This block will only be run on POST requests
  request.post do
    # Do something awesome!
  end
end

Contributing

  1. Fork it ( https://github.com/molovo/tiny/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • @molovo James Dinsdale - creator, maintainer