Git Product home page Git Product logo

app's Introduction

App

app is a server app framework for game development

Feature

  • managed by cluster id and app index, which is common in game development
  • graceful startup and shutdown
  • support for rpc service and http serving
  • use pid which is helpful for monitoring

Get started

import (
   "log"
   "github.com/philipyao/app"
)

func main() {
    var err error
    err = app.HandleBase(
        func(done chan struct{}) error {
            log.Println("app init ok.")
            return nil
        },
        func () {
            log.Println("app shutdown ok.")
        },
    )
    if err != nil {
        log.Fatalf("srv.HandleBase() err: %v", err)
    }
    app.Run()
}
    

After successful build, you will get an binary app, say appTest then just start it with some arguments like this: ./appTest -c 100 -i 1 -l "127.0.0.1" -p 10021


2018/06/03 11:29:21 [srv]App start...
2018/06/03 11:29:21 args: cluster<100>, index<1>, ip<127.0.0.1>, port<10021>
2018/06/03 11:29:21 app init ok.
2018/06/03 11:29:21 [srv]App init ok.
2018/06/03 11:29:21 write pid to /Users/philip/work/git/src/github.com/philipyao/app/pid/run.appTest1.pid

if you want to stop it, just CTRL + C, and it will graceful shutdown


^C2018/06/03 11:29:49 [srv]graceful shutdown...
2018/06/03 11:29:49 app shutdown ok.

TODO

  • rand seed
  • gc ticker
  • custom signal handle
  • custom flag
  • command: help & version & pprof & reload & manual_gc & cpu_num

app's People

Contributors

philipyao avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.