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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?