easyserver

package module
v0.0.0-...-c96426c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

README

EasyServer

A light multy-lingual framework written in Go

Features
  • Multi-lingual structure, so you can use many languages in one project with ease
  • Customisable system: EasyServer can change it's structure for (and with) your project
  • Source-based configuration, which can make your server faster, is JSON-styled, easy-to-learn and comes as a default variant (it means you can always replace it with a JSON variant)
  • FastCGI is supported. (coming soon)

Installation

From source

First of all, you should build EasyMaker or download pre-built variant from Releases. There are scripts build_windows.bat and build_linux.sh for it. Then, you can run

./easymaker install -target=all

for building all parts of EasyServer. Use help target to see other options.

To build sources without installation, you can use build command with the same targets.

In the build folder, you can see your compiled EasyServer and (or) libraries.

Documentation

Visit pkg.go.dev

Documentation

Index

Constants

View Source
const (
	RouteNotFoundPath = "?404"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	http.Handler
	Methods []string
	Headers map[string]string
	Schemas []string
	Data    map[string]any
}

type MiddlewareFunc

type MiddlewareFunc func(next http.Handler) http.Handler

type Module

type Module struct {
	Route
	Middlewares []MiddlewareFunc
	NotExplict  bool
	Models      []interface{}
}

type Route

type Route map[string]Controller

func (Route) UpdateRouteNotFoundController

func (route Route) UpdateRouteNotFoundController(controller Controller)

type Router

type Router struct {
	Modules    map[string]Module
	Default404 http.Handler
	// contains filtered or unexported fields
}

func (*Router) Connect

func (router *Router) Connect() error

func (*Router) DB

func (router *Router) DB() *gorm.DB

func (*Router) GetController

func (router *Router) GetController(requestPath string) *Controller

func (*Router) ModelsList

func (router *Router) ModelsList() []any

func (*Router) ModuleNames

func (router *Router) ModuleNames() []string

func (*Router) NoMiddlewares

func (router *Router) NoMiddlewares(w http.ResponseWriter, r *http.Request)

func (*Router) ServeHTTP

func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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