Goa is a web framework based on middleware, like koa.js.

Goa

Build Status Codecov Go Doc Go Report Mentioned in Awesome Go PR's Welcome

Goa is under construction, if you are familiar with koa or go and interested in this project, please join us.

What is goa?

goa = go + koa

Just like koa, goa is also not bundled with any middleware. But you can expand functionality to meet your needs at will by middlware. It is flexible, light, high-performance and extensible.

Installation

$ go get -u github.com/goa-go/goa

Hello Goa

func main() {
  app := goa.New()

  app.Use(func(c *goa.Context) {
    c.String("Hello Goa!")
  })
  log.Fatal(app.Listen(":3000"))
}

Middleware

Goa is a web framework based on middleware. Here is an example of using goa-router and logger.

package main

import (
  "fmt"
  "log"
  "time"

  "github.com/goa-go/goa"
  "github.com/goa-go/router"
)

func logger(c *goa.Context) {
  start := time.Now()

  fmt.Printf(
    "[%s] <-- %s %s\n",
    start.Format("2006-01-02 15:04:05"),
    c.Method,
    c.URL,
  )
  c.Next()
  fmt.Printf(
    "[%s] --> %s %s %d %s\n",
    time.Now().Format("2006-01-02 15:04:05"),
    c.Method,
    c.URL,
    time.Since(start).Nanoseconds()/1e6,
    "ms",
  )
}

func main() {
  app := goa.New()
  r := router.New()

  r.GET("/", func(c *goa.Context) {
    c.String("Hello Goa!")
  })

  app.Use(logger)
  app.Use(r.Routes())
  log.Fatal(app.Listen(":3000"))
}

If you are unwilling to use goa-router, you can make a custom router middleware as you like.

Maintainers

@NicholasCao.

License

MIT

Similar Resources

Bootstrapper and middleware for Echo framework in golang.

Bootstrapper and middleware for Echo framework in golang.

rk-echo Interceptor & bootstrapper designed for echo framework. Currently, supports bellow functionalities. Name Description Start with YAML Start ser

Jul 9, 2022

Roche is a Code Generator and Web Framework, makes web development super concise with Go, CleanArch

Roche is a Code Generator and Web Framework, makes web development super concise with Go, CleanArch

It is still under development, so please do not use it. We plan to release v.1.0.0 in the summer. roche is a web framework optimized for microservice

Sep 19, 2022

A powerful go web framework for highly scalable and resource efficient web application

webfr A powerful go web framework for highly scalable and resource efficient web application Installation: go get -u github.com/krishpranav/webfr Exa

Nov 28, 2021

A powerful go web framework for highly scalable and resource efficient web application

A powerful go web framework for highly scalable and resource efficient web application

Oct 3, 2022

A web app built using Go Buffalo web framework

Welcome to Buffalo Thank you for choosing Buffalo for your web development needs. Database Setup It looks like you chose to set up your application us

Feb 7, 2022

Lightweight web framework based on net/http.

Goweb Light weight web framework based on net/http. Includes routing middleware logging easy CORS (experimental) Goweb aims to rely only on the standa

Dec 21, 2022

A web based mission control framework.

A web based mission control framework.

Open MCT Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile d

Jan 4, 2023

Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin, a web framework based on Gin and Swagger

Swagger + Gin = SwaGin Introduction SwaGin is a web framework based on Gin and Swagger, which wraps Gin and provides built-in swagger api docs and req

Dec 30, 2022
Comments
  • default Content-Type is  text/plain

    default Content-Type is text/plain

    func main() {
      app := goa.New()
      r := router.New()
    
      r.GET("/", func(c *goa.Context) {
          fmt.Println(c.URL)
          postdata := `<html><head><script src="https://unpkg.com/axios/dist/axios.min.js"></script>
          </head><body><script>
         axios.post('/test', {'id':200,'name':"chi"}).then(res => {  console.log(res.data); });
         </script><h1>axios post </h1></body></html>
    `
    
      c.String(postdata)
    		   // c.String("Hello Goa!")
      })
      r.POST("/test", func(c *goa.Context){
    
    	  fmt.Println(c.Request)
    	 c.String("post from axios !")
     
    			  	  
    			  })
      app.Use(logger)
      app.Use(r.Routes())
      log.Fatal(app.Listen(":3000"))
    }
    

    script not executed
    by curl -v http://localhost:3000/
    http headers output content-Type => plain/text

⚡ Rux is an simple and fast web framework. support middleware, compatible http.Handler interface. 简单且快速的 Go web 框架,支持中间件,兼容 http.Handler 接口

Rux Simple and fast web framework for build golang HTTP applications. NOTICE: v1.3.x is not fully compatible with v1.2.x version Fast route match, sup

Dec 8, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023
Go-igni: monolith-based web-framework in Go Inspired by classical PHP Frameworks like CodeIgnier & Laravel

go-igni Web Framework in Go About This is research project about developing monolith-based web-framework in Go Inspired by classical PHP Frameworks li

Feb 25, 2022
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).

WebGo v4.1.3 WebGo is a minimalistic framework for Go to build web applications (server side) with zero 3rd party dependencies. Unlike full-fledged fr

Jan 1, 2023
Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework.

jin About The jin is a simplified version of the gin web framework that can help you quickly understand the core principles of a web framework. If thi

Jul 14, 2022
a golang web mvc framework, like asp.net mvc.

goku goku is a Web Mvc Framework for golang, mostly like ASP.NET MVC. doc & api Installation To install goku, simply run go get github.com/QLeelulu/go

Dec 7, 2022
Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance. Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。
Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance.  Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。

Tigo(For English Documentation Click Here) 一个使用Go语言开发的web框架。 相关工具及插件 tiger tiger是一个专门为Tigo框架量身定做的脚手架工具,可以使用tiger新建Tigo项目或者执行其他操作。

Jan 5, 2023
A gin-like simple golang web framework.

webgo A gin-like simple golang web framework.

Aug 24, 2022
A gin-like simple golang web framework.

A gin-like simple golang web framework.

Aug 24, 2022