aeridya

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 15 Imported by: 0

README

Aeridya

Single domain webserver/CMS written and extendable using Golang

Description

Aeridya extends the built-in HTTP functionality of Golang to deliver Web Pages where the logic is written in Golang. The final render of the webpage uses Golang's Templating System to deliver static pages. This provides you with the flexibility of HTML/CSS/JavaScript in an easy package, and the speed to do server side logic in Go. The final application is recommended to run via a reverse proxy; specifically NGINX. More documentation on this will be written once the application is further along.

Each Aeridya application consists of a Theme, and Pages. A Theme is called directly by Aeridya and decides how an application's Pages are stored/accessed. A Page consists of a set of instructions for each of the main HTTP Requests, ie. "GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD".

See "example" for the example application. You may also want to see "theme.go" on how the basic theme is implemented.

Using Aeridya

To use Aeridya in your application, you must have a configuration file setup. "See example/conf" for the necessary basic configuration.

The following must be set in the configuration file:

Port = Port to start on (example: 5000)
Domain = Application's Domain: (example: domain.com)
Workers = Max Workers [you can be pretty generous here] (example: 1000)
Development = Deveopment Mode (true|false)
Log = File Path to log (Use stdout to print to terminal)
Statics = File Path to Statics Directory

Aeridya is meant to be easy to use in your own applications. To get started, the following code is required:

package main

import (
	"fmt"
	"github.com/hlfstr/aeridya"
	"os"
)

func main() {
	if e := aeridya.Create("/path/to/config"); e != nil {
		fmt.Println(e)
		os.Exit(1)
	}
	aeridya.Run()
}
Customizing Aeridya

TODO

Documentation

Overview

Allows static items to be served from domain.com/item Items requested should be located at root of statics dir

Index

Constants

View Source
const (
	NAME       = "Aeridya"
	MAJORVER   = "0"
	MINORVER   = "9"
	RELEASEVER = "1"
	DESC       = "Server and CMS"
)

Variables

View Source
var (
	Log     *logit.Logger
	Handler *handler.Handler
	Static  *statics
	Config  *configurit.Conf

	Port        string
	Domain      string
	FullDomain  string
	Development bool
	HTTPS       bool

	Theme theming
)

Functions

func AddTrailingSlash

func AddTrailingSlash(h http.Handler) http.Handler

func Create

func Create(conf string) error

func Info

func Info() string

Info returns a formatted string of Version and the Description

func NewStatics

func NewStatics(path string) *statics

Create will create the Statics Object and return it Requires a path to the statics dir

func NoTrailingSlash

func NoTrailingSlash(h http.Handler) http.Handler

func Run

func Run() error

func ServePage

func ServePage(resp *Response, p Paging)

func ThemeError

func ThemeError(resp *Response, t theming)

func Version

func Version() string

Version returns a formatted string of the name/version number

Types

type ATheme

type ATheme struct {
	Page
}

func (*ATheme) Error

func (t *ATheme) Error(resp *Response)

func (*ATheme) Get

func (t *ATheme) Get(resp *Response)

func (*ATheme) Init

func (t *ATheme) Init()

func (*ATheme) Serve

func (t *ATheme) Serve(resp *Response)

type Page

type Page struct {
	Route string
	Title string
	// contains filtered or unexported fields
}

func (*Page) Delete

func (p *Page) Delete(resp *Response)

func (*Page) Get

func (p *Page) Get(resp *Response)

func (*Page) Head

func (p *Page) Head(resp *Response)

func (*Page) LoadPage

func (p *Page) LoadPage() error

func (*Page) OnOptions

func (p *Page) OnOptions(opts ...string)

func (*Page) Options

func (p *Page) Options(resp *Response)

func (*Page) Post

func (p *Page) Post(resp *Response)

func (*Page) Put

func (p *Page) Put(resp *Response)

func (*Page) Unsupported

func (p *Page) Unsupported(resp *Response)

type Paging

type Paging interface {
	LoadPage() error
	Get(resp *Response)
	Put(resp *Response)
	Post(resp *Response)
	Delete(resp *Response)
	Options(resp *Response)
	Head(resp *Response)
	Unsupported(resp *Response)
}

type Response

type Response struct {
	W      http.ResponseWriter
	R      *http.Request
	Status int
	Err    error
	Data   interface{}
}

func (*Response) AddCookie

func (r *Response) AddCookie(name string, hour int, values map[string]string) error

func (*Response) Bad

func (r *Response) Bad(status int, msg string)

func (*Response) DeleteCookie

func (r *Response) DeleteCookie(name string)

func (*Response) Error

func (r *Response) Error(msg string)

func (*Response) GetCookieValues

func (r *Response) GetCookieValues(name string) (map[string]string, error)

func (*Response) Good

func (r *Response) Good(status int)

func (*Response) RGet

func (r *Response) RGet(name string) (string, bool)

func (*Response) Redirect

func (r *Response) Redirect(status int, url string)

Directories

Path Synopsis
utils

Jump to

Keyboard shortcuts

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