All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ruby-on-rails-server.routes.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
=begin
{{> info}}
=end
Rails.application.routes.draw do

  def add_openapi_route http_method, path, opts = {}
    full_path = path.gsub(/{(.*?)}/, ':\1')
    match full_path, to: "#{opts.fetch(:controller_name)}##{opts[:action_name]}", via: http_method
  end

{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
  add_openapi_route '{{httpMethod}}', '{{{basePathWithoutHost}}}{{{path}}}', controller_name: '{{classVarName}}', action_name: {{#isRestfulIndex}}'index'{{/isRestfulIndex}}{{#isRestfulCreate}}'create'{{/isRestfulCreate}}{{#isRestfulUpdate}}'update'{{/isRestfulUpdate}}{{#isRestfulShow}}'show'{{/isRestfulShow}}{{#isRestfulDestroy}}'destroy'{{/isRestfulDestroy}}{{^isRestful}}'{{nickname}}'{{/isRestful}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
end




© 2015 - 2024 Weber Informatics LLC | Privacy Policy