Giter Club home page Giter Club logo

ginweb's Introduction

GinWeb

A golang web project template based on gin framework

Features:

gin本身已经相当灵活,但是由于项目中有一些模块是我们必须或者经常使用的,所以进行了集成,如果不需要这些模块或者要使用自己的模块实现,请考虑直接使用gin框架

  1. 集成endless在类Unix平台下实现不停机重启服务
  2. 集成log4go: 类似于log4j的配置式的log输出,可以控制日记级别,输出格式以及滚动
  3. 集成recovery: 出错时尝试进行恢复并使用log4go记录为critical级别

USAGE:

func main() {
    r := ginweb.NewGinweb()
    
    r.GET("/welcome", func(c *gin.Context) {
        firstname := c.DefaultQuery("firstname", "Guest")
        lastname := c.Query("lastname")
        c.String(http.StatusOK, "Hello %s %s", firstname, lastname)
    })
    
    r.Run(conf.Conf.SERVER.PORT)
}

后台启动app(供参考):

$> nohup ./appname > /dev/null 2>stderr.log &

不停机重启服务(在在Unix/Linux/Mac)上能起作用:

$> pgrep appname | xargs kill -HUP

TODO:

  1. Portable模式, 支持内嵌conf.yml文件和log4go.xml文件, 构建时将生成一个唯一的一个可执行文件, 单个文件更便于分发。

ginweb's People

Contributors

kimiazhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

antgan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.