Go Web Framework

Neo

Build Status GoDoc

Go Web Framework

Installation

# framework
go get github.com/ivpusic/neo

# CLI tool
go get github.com/ivpusic/neo/cmd/neo

Documentation

Project Site

API Documentation

Example

Create Neo application:

neo new myapp
cd myapp
package main

import (
    "github.com/ivpusic/neo"
)

func main() {
    app := neo.App()

    app.Get("/", func(ctx *neo.Ctx) (int, error) {
        return 200, ctx.Res.Text("I am Neo Programmer")
    })

    app.Start()
}

Run it:

neo run main.go

License

MIT

Similar Resources

An ideally refined web framework for Go.

Air An ideally refined web framework for Go. High-performance? Fastest? Almost all web frameworks are using these words to tell people that they are t

Dec 15, 2022

An opinionated productive web framework that helps scaling business easier.

An opinionated productive web framework that helps scaling business easier.

appy An opinionated productive web framework that helps scaling business easier, i.e. focus on monolith first, only move to microservices with GRPC la

Nov 4, 2022

BANjO is a simple web framework written in Go (golang)

BANjO banjo it's a simple web framework for building simple web applications Install $ go get github.com/nsheremet/banjo Example Usage Simple Web App

Sep 27, 2022

beego is an open-source, high-performance web framework for the Go programming language.

beego is an open-source, high-performance web framework for the Go programming language.

Beego Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend services. It is inspired by To

Jan 1, 2023

High performance, minimalist Go web framework

High performance, minimalist Go web framework

Supported Go versions As of version 4.0.0, Echo is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is r

Jan 2, 2023

⚡️ Express inspired web framework written in Go

⚡️ Express inspired web framework written in Go

Fiber is an Express inspired web framework built on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development w

Jan 2, 2023

Go web framework with a natural feel

Fireball Overview Fireball is a package for Go web applications. The primary goal of this package is to make routing, response writing, and error hand

Nov 9, 2022

Gearbox :gear: is a web framework written in Go with a focus on high performance

Gearbox :gear: is a web framework written in Go with a focus on high performance

gearbox ⚙️ is a web framework for building micro services written in Go with a focus on high performance. It's built on fasthttp which is up to 10x fa

Jan 3, 2023

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

Goa 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 lik

Sep 27, 2022
Comments
  • How to wildcard

    How to wildcard "" and "/" for route?

    Now need two func for route "/login" and "/login/"? such as for "/" app.Get("/", func(ctx *neo.Ctx) (int, error) { ... }) i need another func for "": app.Get("", func(ctx *neo.Ctx) (int, error) { ... })

  • can you add sub region?

    can you add sub region?

    such as: father := app.Region().Prefix("/login") father.Use(fn Widdleware) son := father.Region().Prefix("/son") (or son := father.Prefix("/son")) //whole is /login/son son.Get("", func(ctx *neo.Ctx) (int, error) { ... })

  • git/ivp/neo 11:43:37 ✖[ERRO] ▶ exit status 1

    git/ivp/neo 11:43:37 ✖[ERRO] ▶ exit status 1

    The program does not work properly go version:1.8.3

    package main
    import (
    	"github.com/ivpusic/neo"
    )
    
    func main() {
    	app := neo.App()
    
    	app.Get("/", func(ctx *neo.Ctx) (int, error) {
    		return 200, ctx.Res.Text("I am Neo Programmer")
    	})
    
    	app.Start()
    }
    

    run command:

     apple@henjue-mac: neo run sync_token_api.go
     git/ivp/neo 11:43:37 ✖[ERRO] ▶ exit status 1
    
  • Would a single ctx.Error be better than ctx.Errors?

    Would a single ctx.Error be better than ctx.Errors?

    Hi, I see you add Errors to ctx, but I'm thinking what gin does may not a good idea.

    Basically, when we get an error, we just want to return from route handler. Collecting errors like gin seems doesn't make sense

    Golang's team offered a best practice on their blog about handling errors: Errors are values

    Their solution is: define a single error object in a top level struct ( which should be in ctx in our cases )

    So we can do something like this:

    ctx.Error := SomeFunc()
    // we don't need to deal with error here, a middleware will handle it automatically
    if ctx.Error != nil { return 0, nil}
    

    But with ctx.Errors, I have to write more code:

    err := SomeFunc()
    if err != nil {
        ctx.Error(err)
        return 0, nil
    }
    

    If we handle it with ctx.Errors[0]:

    ctx.Errors := make([]error, 1)
    ctx.Errors[0] := SomeFunc()
    

    In this way, ctx.HasErrors() will always be true even if ctx.Errors[0] is nil

    Following golang team's strategy, with a single ctx.Error, we can even do something like this:

    func SomeFunc(param1, param2, err) error {
        //check error first
        if err != nil {return}
        //do something
    }
    
    func SomeFunc2(param1, param2, err) error {
        if err != nil {return}
        //do something else
    }
    
    
    ctx.Error := SomeFunc(param1, param2, ctx.Error)
    ctx.Error := SomeFunc2(param1, param2, ctx.Error)
    ctx.Error := SomeFunc3(param1, param2, ctx.Error)
    return 200, ctx.Text("done")
    //then, middleware will handle ctx.Error, if there is one.
    

    In this way, we don't need to check ctx.Error at all, since every function has checked that error at beginning, if there is an error, all those functions will just return.

    I think golang team's solution is much better than gin's, a single ctx.Error may truely better than collecting all errors.

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
⚡ 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
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
re:Web enables classic web applications to run on AWS Lambda.
re:Web enables classic web applications to run on AWS Lambda.

re:Web re:Web enables classic web applications to run on AWS Lambda. re:Web interfaces with the Lambda Runtime API. It translates API Gateway requests

Jan 1, 2023
Chainrand contract + web frontend + web backend

Chainrand-web This repo contains the implementation of Chainrand. https://chainrand.io Smart Contract Contains functionality to tie a Chainlink VRF to

Dec 8, 2021
Gin is a HTTP web framework written in Go (Golang).
Gin is a HTTP web framework written in Go (Golang).

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

Jan 3, 2023