GithubHelp home page GithubHelp logo

chaoswars / restapidoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loic911/rest-api-doc

0.0 2.0 0.0 2.89 MB

License: MIT License

JavaScript 48.11% CSS 0.75% Groovy 43.39% Handlebars 7.75%

restapidoc's Introduction

RestApiDoc

Full doc: http://loic911.github.io/restapidoc/

#Plugin Configuration

##Including the Grails plugin

The plugin depends on both jQuery and Bootstrap, so include them as runtime dependencies:

plugins {
  compile ":rest-api-doc:0.6.3"
  runtime ":jquery:1.11.1"
  runtime ':twitter-bootstrap:3.3.2.1'
}

##Config.groovy options

At minimum, you need to set the basePath option for the plugin, which often is the Grails URL of the project using the plugin:

grails.plugins.restapidoc.basePath = "http://localhost:8080/<projectname>"

You also might need to set options for Bootstrap and for jQuery in order for them to work. This depends on your project configuration: alternative options are available and it is suggested that you read the documentation for both plugins to find out what best suits your needs. The following options enable a simple project to use the restapidoc plugin out of the box:

grails.plugins.twitterbootstrap.defaultBundle = false
grails.views.javascript.library="jquery"

##Sitemesh layout selection You can use an existing layout for the restapidoc pages, or create a separate one. The RestApiDoc plugin will use the grails-app/views/layouts/main.gsp layout. If you wish to use another layout, you can configure which layout to use by setting the grails.plugins.restapidoc.layout option. Again, the included options for jQuery are one of several alternatives, and it is suggested that you read the jQuery plugin documentation to see which option is more appropriate for your application

grails-app/conf/Config.groovy

grails.plugins.restapidoc.layout = "restapidoc_layout"

##Including the resources when using the Asset Pipeline To include your bootstrap resources add the following to your application's css or js file.

Javascript grails-app/assets/javascripts/application.js:

//= require jquery
//= require bootstrap
//= require restapidoc
//= require_tree .
//= require_self

Stylesheet grails-app/assets/javascripts/application.css:

/*
*= require bootstrap
*= require restapidoc
*= require_self
*/

###Edit your Sitemesh layout grails-app/views/layouts/<layout>.gsp

<!DOCTYPE html>
    <head>
        <title><g:layoutTitle/></title>
        <asset:javascript src="application.js"/>
        <asset:stylesheet href="application.css"/>
        <g:layoutHead/>
    </head>
    <body>
        <g:layoutBody/>
        <asset:javascript src="restapidoc/restapidoc.js"/>
    </body>
</html>

####Supporting Internet Explorer If you wish to support Internet Explorer lower than version 9, then you need to add the following just above <g:layoutHead>:

<!--[if lt IE 9]>
    <asset:javascript src="html5shiv/html5shiv.js"/>
<![endif]-->

##Including the resources when using the Resources plugin ###Edit your Sitemesh layout grails-app/views/layouts/<layout>.gsp

<!DOCTYPE html>
    <html lang="en">
    <head>
        <title><g:layoutTitle/></title>
        <r:require modules="bootstrap, restapidoc"/>
        <g:layoutHead/>
        <g:javascript library="jquery" plugin="jquery"/>
        <g:javascript library="application"/>
        <r:layoutResources />
    </head>
    <body>
        <g:layoutBody/>
        <r:layoutResources/>
    </body>
</html>

####Supporting Internet Explorer If you wish to support Internet Explorer lower than version 9, then your <r:requireModules> line should look like this:

<r:require modules="restapidoc_html5shiv, bootstrap, restapidoc"/>

#Logging You can enable logging for the restapidoc plugin by adding the following line to grails-app/conf/Config.groovy:

log4j.main = {
    info 'org.restapidoc'
}

#Known issues If resource debugging is enabled in any of the environments, then when running the application on that environment restapidoc will be unable to find the Resource Plugin module assets. Disable resource debugging in grails-app/conf/Config.groovy (by default on the development environment) in order to use the plugin:

environments {
    development {
        grails.resources.debug = false
    }
}

restapidoc's People

Contributors

aiqinlai avatar cbm-afoulfoin avatar loic911 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.