Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/get-ion/ion

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/get-ion/ion

  • v0.0.0-20170809140925-0a1b18686e70
  • Source
  • Go
  • Socket score

Version published
Created
Source

ion

build status report card godocs get support view examples ion channel on slack #get-ion on freenode


Ion is a fast, simple and efficient micro web framework for Go. It provides a beautifully expressive and easy to use foundation for your next website, API, or distributed app.

📑 Table of contents

🚀 Installation

The only requirement is the Go Programming Language, at least version 1.8.x

$ go get github.com/get-ion/ion

ion takes advantage of the vendor directory feature. You get truly reproducible builds, as this method guards against upstream renames and deletes.

// file: main.go
package main
import (
    "github.com/get-ion/ion"
    "github.com/get-ion/ion/context"
)
func main() {
    app := ion.New()
    // Load all templates from the "./templates" folder
    // where extension is ".html" and parse them
    // using the standard `html/template` package.
    app.RegisterView(ion.HTML("./templates", ".html"))

    // Method:    GET
    // Resource:  http://localhost:8080
    app.Get("/", func(ctx context.Context) {
        // Bind: {{.message}} with "Hello world!"
        ctx.ViewData("message", "Hello world!")
        // Render template file: ./templates/hello.html
        ctx.View("hello.html")
    })

    // Start the server using a network address and block.
    app.Run(ion.Addr(":8080"))
}
<!-- file: ./templates/hello.html -->
<html>
<head>
    <title>Hello Page</title>
</head>
<body>
    <h1>{{.message}}</h1>
</body>
</html>
$ go run main.go
> Now listening on: http://localhost:8080
> Application started. Press CTRL+C to shut down.
Hello World with Go 1.9

If you've installed Go 1.9 then you can omit the github.com/get-ion/ion/context package from the imports statement.

// +build go1.9

package main

import "github.com/get-ion/ion"

func main() {
	app := ion.New()
	app.RegisterView(ion.HTML("./templates", ".html"))
	
	app.Get("/", func(ctx ion.Context) {
		ctx.ViewData("message", "Hello world!")
		ctx.View("hello.html")
	})

	app.Run(ion.Addr(":8080"))
}

We expect Go version 1.9 to be released in August, however you can install Go 1.9 beta today.

Installing Go 1.9beta2

  1. Go to https://golang.org/dl/#go1.9beta2
  2. Download a compatible, with your OS, archieve, i.e go1.9beta2.windows-amd64.zip
  3. Unzip the contents of go1.9beta2.windows-amd64.zip/go folder to your $GOROOT, i.e C:\Go
  4. Open a terminal and execute go version, it should output the go1.9beta2 version, i.e:
C:\Users\hiveminded>go version
go version go1.9beta2 windows/amd64
Why another new web framework?

ion is easy, it has a familiar API while in the same has far more features than Gin or Martini.

You own your code —it will never generate (unfamiliar) code for you, like Beego, Revel and Buffalo do.

It's not just-another-router but its overall performance is equivalent with something like httprouter.

Unlike fasthttp, ion provides full HTTP/2 support for free.

Compared to the rest open source projects, this one is very active and you get answers almost immediately.

👥 Community

Join the welcoming community of fellow ion developers in slack.

🏫 Learn

The awesome ion community is always adding new examples, _examples is a great place to get started!

Read the godocs for a better understanding.

💙 Support

🥇 People

The current lead maintainer is Bill Qeras, Jr.

List of all contributors

FAQs

Package last updated on 09 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc