Skip to content

yuin/cidre-ego

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cidre-ego: an ego integration for the cidre web framework

image

cidre-ego privides an easy way to integrate the ego template engine into the cidre webframework.

Installation

go get github.com/yuin/cidre-ego

Usage

Create ego templates and run the ego command.

<%! func ShowItems(w io.Writer, items []string) error %>
<%% import "strings" %%>
<%% import "github.com/yuin/cidre-ego" %%>
    <ul>
      <% for _, item := range items { %>
        <li><%= item %></li>
      <% } %>
    </ul>
<% ego.EgoLayout(w, MyLayout) %>
<%! func MyLayout(w io.Writer, contents string) error %>
    <html><body>
    <%== contents %>
    </body></html>
ego templates

Set EgoRenderer for a cidre app

app := cidre.NewApp(appConfig)
app.Renderer = ego.NewEgoRenderer()
items := app.MountPoint("/items/")
items.Get("show_item", ".*", func(w http.ResponseWriter, r *http.Request) {
    app.Renderer.Html(w, ShowItems, []string{"a", "b", "c"})
})

License

MIT

Author

Yusuke Inuzuka

About

An ego integration for the cidre web framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages