Popularity
8.8
Growing
Activity
8.8
Growing
105
8
6

Programming language: Crystal
Tags: Web Frameworks    
Latest version: v1.1.0

grip alternatives and similar shards

Based on the "Web Frameworks" category

Do you think we are missing an alternative of grip or a related project?

Add another 'Web Frameworks' Shard

README

Grip

Grip is a microframework for building RESTful web applications. It is designed to be modular and easy to use, with the ability to scale up to the limits of the Crystal programming language. It offers extensibility and it has integrated middleware called "pipes" which alter the parts of the request/response context and pass it on to the actual endpoint. It has a router which somewhat resembles that of Phoenix framework's router and most of all it is fast, peaking at 1,663,946 requests/second for plain text response.

Motivation

The existance of this project is due to the fact that Kemal lacks one crucial part of every successful framework, a structure. An example for the absence of structure can be found here.

Build status

Build Status Build Status

Features

  • HTTP 1.1 support.
  • WebSocket RFC 6455 support.
  • Built-in exceptions support.
  • Parameter handling support.
  • JSON serialization and deserialization support.
  • Built-in middleware support.
  • Request/Response context, inspired by expressjs.
  • Advanced routing support.

Code example

Add this to your application's application.cr:

require "grip"

class Index < Grip::Controllers::Http
  def get(context)
    context
      .put_status(200) # Assign the status code to 200 OK.
      .json({"id" => 1}) # Respond with JSON content.
      .halt # Close the connection.
  end

  def index(context)
    id =
      context
        .fetch_path_params
        .["id"]

    context
      .json({"id" => id})
  end
end

class Application < Grip::Application
  def initialize
    pipeline :api, [
        Grip::Pipes::PoweredByHeader.new
    ]

    pipeline :web, [
        Grip::Pipes::SecureHeaders.new
    ]

    get "/", Index, via: :api
    get "/:id", Index, via: [:web, :api], override: :index
  end
end

app = Application.new
app.run

Installation

Add this to your application's shard.yml:

dependencies:
  grip:
    github: grip-framework/grip

And run this command in your terminal:

shards install

API Reference

Documentation can be found on the official website of the Grip framework.

Contribute

See our contribution guidelines and read the code of conduct.

Contributors

Thanks

  • Kemal - Underlying routing, parameter parsing and filtering mechanisms.
  • Gitter - Technical help, feedback and framework design tips.
  • Crystal - Detailed documentation, examples.