Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

Sphire Core

Build and Test Dependency Graph pre-release tagged-release

Core is a Go framework for fast API prototyping built on:

  • fasthttp (server)
  • github.com/qiangxue/fasthttp-routing (router)

Setup

Core is configured via a JSON file loaded into the Config struct.

Environment variables

  • SPC_ENV (preferred): selects the config file <env>.json (default: dev)
  • SPC_CONFIG (preferred): absolute path to a config file (overrides SPC_ENV)

Backward compatible fallbacks are still accepted:

  • SPK_ENV
  • SPK_CONFIG

Minimal start

package main
import (
 "log"
 core "github.com/sphireinc/core/v1"
)
func main() {
 app, err := core.New()
 if err != nil {
 log.Fatal(err)
 }
 if err := app.Run(); err != nil {
 log.Fatal(err)
 }
}

Example app code lives under cmd/example/

Routing

Handlers use this signature:

func handler(ctx *core.Context) error {
 return core.HandleResponseJSON(ctx, []byte(`{}`), 200)
}

Register routes before Run():

app.Router.Get("/our-custom-route", handler)

Profiling / Stats View

When enabled, Core uses github.com/go-echarts/statsview.

Default endpoint:

  • :18066/debug/statsview

About

A Go framework for fast API development

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /