v0.0.1 Latest Latest

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

Go to latest
Published: Apr 28, 2017 License: MIT Imports: 12 Imported by: 1



Package lib contains all project logic.



View Source
const (
	Markdown = ".md"
	Gocode   = ".go"


This section is empty.


This section is empty.


type App

type App struct {
	Log    *Logger
	Config *Config
	// contains filtered or unexported fields

App models current application

func NewApp

func NewApp() (application *App)

NewApp provides a new App struct with its initializated fields

func (*App) Parse

func (a *App) Parse(args []string)

Parse function process the arguments

func (*App) Run

func (a *App) Run()

Run is invoked to start the server application logic.

func (*App) Version

func (a *App) Version() (v string)

Version function returns the application version

type Config

type Config struct {
	Pwd          string
	Filename     string
	IsProduction bool

Config models an entity config reader

func NewConfig

func NewConfig() (config *Config, err error)

NewConfig creates a config struct.

func (*Config) BooleanDefault

func (c *Config) BooleanDefault(property string, boolDefault bool) (result bool)

BooleanDefault function gets config property from default section or use default boolean value

func (*Config) Default

func (c *Config) Default(property string) (result string)

Default function gets config property from default section

func (*Config) File

func (c *Config) File() (file string)

File function returns configuration file path

func (*Config) StringDefault

func (c *Config) StringDefault(property string, strDefault string) (result string)

StringDefault gets config property from default section or use default value

type File

type File struct {
	Name      string
	Path      string
	Format    string
	HasFormat bool

func (*File) AbsoluteName

func (self *File) AbsoluteName() string

Returns absolute file name

func (*File) Pwd

func (self *File) Pwd() (path string, err error)

Gets current directory

func (*File) Read

func (f *File) Read() (data []byte, err error)

Read file and set Format field

type Logger

type Logger struct {

Logger represents a logger strut

func GetLogger

func GetLogger() (l *Logger)

GetLogger configure and returns logger struct

type Server

type Server struct {
	Debug bool
	Index string
	Port  string
	Path  string

Server represents web server logic and attributes

func (*Server) Run

func (s *Server) Run() (err error)

Run publish the web server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServerHTTP is the handler function to publish into web server

func (*Server) Show

func (s *Server) Show(rw http.ResponseWriter, r *http.Request)

Show is the function that publish all files in the directory.

func (*Server) ShowMarkdown

func (s *Server) ShowMarkdown(rw http.ResponseWriter, data []byte, file File)

ShowMarkdown contains generation logic from markdown to html.

Jump to

Keyboard shortcuts

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