Grape

在 Ruby 中创建类似 REST api 的、偏向于自己使用的框架。「An opinionated framework for creating REST-like APIs in Ruby.」

Github星跟踪图

grape logo

Gem Version
Build Status
Code Climate
Coverage Status
Inline docs
Join the chat at https://gitter.im/ruby-grape/grape

Table of Contents

What is Grape?

Grape is a REST-like API framework for Ruby. It's designed to run on Rack
or complement existing web application frameworks such as Rails and Sinatra by
providing a simple DSL to easily develop RESTful APIs. It has built-in support
for common conventions, including multiple formats, subdomain/prefix restriction,
content negotiation, versioning and much more.

Stable Release

You're reading the documentation for the next release of Grape, which should be 1.3.1.
Please read UPGRADING when upgrading from a previous version.
The current stable release is 1.3.0.

Project Resources

Installation

Ruby 2.4 or newer is required.

Grape is available as a gem, to install it just install the gem:

gem install grape

If you're using Bundler, add the gem to Gemfile.

gem 'grape'

Run bundle install.

Basic Usage

Grape APIs are Rack applications that are created by subclassing Grape::API.
Below is a simple example showing some of the more common features of Grape in
the context of recreating parts of the Twitter API.

module Twitter
  class API < Grape::API
    version 'v1', using: :header, vendor: 'twitter'
    format :json
    prefix :api

    helpers do
      def current_user
        @current_user

主要指标

概览
名称与所有者ruby-grape/grape
主编程语言Ruby
编程语言Ruby (语言数: 3)
平台Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2010-08-02 14:25:08
推送于2025-05-09 22:42:13
最后一次提交2025-05-09 18:42:12
发布数74
最新版本名称v2.3.0 (发布于 2025-02-08 14:32:52)
第一版名称v0.0.0.alpha.1 (发布于 )
用户参与
星数9.9k
关注者数207
派生数1.2k
提交数2.8k
已启用问题?
问题数1183
打开的问题数222
拉请求数1032
打开的拉请求数32
关闭的拉请求数311
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?