gomelon

package module
v0.0.0-...-4426a52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2015 License: BSD-3-Clause Imports: 9 Imported by: 0

README

gomelon Build Status GoDoc

Lightweight Go framework for building web services, inspired by Dropwizard.

Overview

Gomelon is a partial port of Dropwizard in Go. Besides of builtin Go packages, it utilizes a number of libraries in order to build a server stack quickly, including:

  • goji: a robust web framework.
  • gol: a simple hierarchical logging API.
  • metrics: a minimalist instrumentation library.
  • validator: extensible value validations.

Features supported:

  • Commands: for controlling your application from command line.
  • Bundles: for modularizing your application.
  • Managed Objects: for starting and stopping your components.
  • HealthChecks: for checking health of your application in production.
  • Metrics: for monitoring and statistics.
  • Tasks: for administration.
  • Resources: for RESTful endpoints.
  • Filters: for injecting middlewares.
  • Logging: for understanding behaviors of your application.
  • Configuration: for application parameters.
  • Banner: for fun. :)
  • and more...

Examples

See example

INFO  [2015-02-04T12:00:01.289+10:00] gomelon/server: starting MyApp
    ______
   /\   __\______
  /..\  \  \     \
 /....\_____\  \  \
 \..../ / / /\_____\
  \../ / / /./   __/
   \/_____/./__   /
          \/_____/

INFO  [2015-02-04T12:00:01.289+10:00] gomelon/assets: registering AssetsBundle for path /static/
DEBUG [2015-02-04T12:00:01.289+10:00] gomelon/server: resources = [*rest.XMLProvider,*main.usersResource,*main.userResource]
INFO  [2015-02-04T12:00:01.289+10:00] gomelon/server: endpoints =

    GET     /users (*main.usersResource)
    POST    /users (*main.usersResource)
    GET     /user/:name (*main.userResource)
    POST    /user/:name (*main.userResource)
    DELETE  /user/:name (*main.userResource)

INFO  [2015-02-04T12:00:01.290+10:00] gomelon/admin: tasks =

    POST    /tasks/gc (*core.gcTask)
    POST    /tasks/log (*logging.logTask)
    POST    /tasks/rmusers (*main.usersTask)

DEBUG [2015-02-04T12:00:01.290+10:00] gomelon/admin: health checks = [UsersHealthCheck]
INFO  [2015-02-04T12:00:01.290+10:00] example: hello MyApp
INFO  [2015-02-04T12:00:01.290+10:00] gomelon/server: listening :8080
INFO  [2015-02-04T12:00:01.290+10:00] gomelon/server: listening :8081

Contributing

The project still lacks of coffee and swears. Comments, issues and pull requests are welcome.

Documentation

Overview

Package gomelon provides a lightweight framework for building web services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(app core.Application, args []string) error

Run executes application with given arguments

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application is the default gomelon application which supports server command.

func (*Application) Initialize

func (app *Application) Initialize(bootstrap *core.Bootstrap)

Initializes the application bootstrap.

func (*Application) Name

func (app *Application) Name() string

func (*Application) Run

func (app *Application) Run(interface{}, *core.Environment) error

When the application runs, this is called after the Bundles are run. Override it to add handlers, tasks, etc. for your application.

func (*Application) SetName

func (app *Application) SetName(name string)

type CheckCommand

type CheckCommand struct {
	ConfigurationCommand
}

func (*CheckCommand) Description

func (c *CheckCommand) Description() string

func (*CheckCommand) Name

func (c *CheckCommand) Name() string

func (*CheckCommand) Run

func (c *CheckCommand) Run(bootstrap *core.Bootstrap) error

type Configuration

type Configuration struct {
	Server  server.Factory
	Logging logging.Factory
	Metrics metrics.Factory
}

Configuration is the default configuration that implements core.Configuration interface.

func (*Configuration) LoggingFactory

func (c *Configuration) LoggingFactory() core.LoggingFactory

func (*Configuration) MetricsFactory

func (c *Configuration) MetricsFactory() core.MetricsFactory

func (*Configuration) ServerFactory

func (c *Configuration) ServerFactory() core.ServerFactory

type ConfigurationCommand

type ConfigurationCommand struct {
	// Configuration is the original configuration provided by application.
	Configuration interface{}
	// contains filtered or unexported fields
}

ConfigurationCommand parses configuration.

func (*ConfigurationCommand) Run

func (command *ConfigurationCommand) Run(bootstrap *core.Bootstrap) error

type EnvironmentCommand

type EnvironmentCommand struct {
	ConfigurationCommand
	Environment *core.Environment
}

EnvironmentCommand creates a new Environment from provided Bootstrap.

func (*EnvironmentCommand) Run

func (command *EnvironmentCommand) Run(bootstrap *core.Bootstrap) error

type ServerCommand

type ServerCommand struct {
	EnvironmentCommand
	Server core.Server
}

ServerCommand implements Command.

func (*ServerCommand) Description

func (command *ServerCommand) Description() string

Description returns description of the ServerCommand.

func (*ServerCommand) Name

func (command *ServerCommand) Name() string

Name returns name of the ServerCommand.

func (*ServerCommand) Run

func (command *ServerCommand) Run(bootstrap *core.Bootstrap) error

Run runs the command with the given bootstrap.

Directories

Path Synopsis
Package assets provides a bundle for serving static asset files.
Package assets provides a bundle for serving static asset files.
Package configuration provides JSON and YAML support for gomelon configuration.
Package configuration provides JSON and YAML support for gomelon configuration.
Package core provides APIs and basic behaviors for a server stack like Dropwizard.
Package core provides APIs and basic behaviors for a server stack like Dropwizard.
Package debug adds debug endpoint to admin page.
Package debug adds debug endpoint to admin page.
example
Package logging provides logging configuration for applications.
Package logging provides logging configuration for applications.
Package metrics provides metrics configuration for applications.
Package metrics provides metrics configuration for applications.
Package rest provides RESTful support for applications.
Package rest provides RESTful support for applications.
Package server supports dynamic routes.
Package server supports dynamic routes.
filter
Package filter provides an API to intercept HTTP requests and responses.
Package filter provides an API to intercept HTTP requests and responses.
logging
Package logging provides a logger for HTTP requests as a filter.
Package logging provides a logger for HTTP requests as a filter.
recovery
Package recovery provides a filter which can recover panics.
Package recovery provides a filter which can recover panics.
Package util provides various utilities for gomelon applications.
Package util provides various utilities for gomelon applications.
Package validation provides validator for applications.
Package validation provides validator for applications.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL