Skip to content

Instantly share code, notes, and snippets.

@illyabusigin
Created July 19, 2016 16:43
Show Gist options
  • Select an option

  • Save illyabusigin/52d2634f6eebecef75b2da2acf88b3ad to your computer and use it in GitHub Desktop.

Select an option

Save illyabusigin/52d2634f6eebecef75b2da2acf88b3ad to your computer and use it in GitHub Desktop.

Revisions

  1. illyabusigin created this gist Jul 19, 2016.
    42 changes: 42 additions & 0 deletions design.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    package design

    import (
    . "github.com/goadesign/goa/design"
    . "github.com/goadesign/goa/design/apidsl"
    )

    var _ = API("test", func() {
    Title("test")
    Description("test")
    Host("localhost:8080")
    Scheme("http")
    BasePath("/v1/")
    Produces("application/json")
    })

    var _ = Resource("test", func() {
    BasePath("/test")
    Action("show", func() {
    Routing(GET("/"))
    Response(OK, Menu)
    })
    })

    var Menu = MediaType("application/vnd.menu+json", func() {
    Attributes(func() {
    Attribute("name", String, "The name of an application")
    Attribute("children", CollectionOf("application/vnd.menu+json"), func() {
    View("nameonly")
    })

    })
    View("default", func() {
    Attribute("name")
    Attribute("children", func() {
    View("nameonly")
    })
    })
    View("nameonly", func() {
    Attribute("name")
    })
    })