LoginSignup
5
1

More than 5 years have passed since last update.

go-on-rails: A Rails generator to develop or generate a Go application

Last updated at Posted at 2017-09-21

The project's repo: https://github.com/railstack/go-on-rails

go-on-rails is a Rails generator aims to:

  • Integrate some APIs written in Golang to existed Rails app for high performance
  • Use your farmiliar Rails tools to develope and manage a Golang app project
  • Convert a not very complicated Rails app to Golang equivalent

Here's a simple example(tutorial) shows the basic usage of go-on-rails generator, and another example shows how to integrate Go APIs in a Rails project.

Prerequisites

  • Rails 4.2+
  • Golang 1.7+

Installation

Add this line to your application's Gemfile:

gem 'go-on-rails', '~> 0.3.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install go-on-rails

Usage

You must have a Rails app or to create one before you can try go-on-rails generator to convert a Rails app to Golang codes.

After that you can just run the command to convert the application:

rails g gor [dev(elopment) | pro(duction) | test] [-m model_a model_b model_c ...]

Then a directory named "go_app" with Golang codes will be generated under your Rails app root path.

Install the dependent Golang packages:

rails gor:deps

Then change to the go_app directory and run:

go run main.go

You can visit the page in http://localhost:4000 by default.

More command details about go-on-rails generator:

rails g gor --help

More details to visit the project's repo: https://github.com/railstack/go-on-rails

Issues and PRs are very Welcome !!

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1