web

package
v0.0.0-...-69ec8c5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2017 License: MIT Imports: 30 Imported by: 0

README

Web Source

Plan is as follows:

  • Build with gobble
  • CSS
    • One compiled townsourced.min.css file built with less from bootstrap and fontawesome source
  • JS
    • Built with esperanto + amdclean + gobble
    • Ractive Components built to es6 via gobble-ractive, then everything is run through esperanto
    • jquery & ractive loaded globally
      • jquery loaded from google cdn
      • ractive loaded locally
    • ts.js - API library for interacting with the townsourced API, and any other global utility functions
      • may end up being loaded as modules instead of one global library
  • Minimum Browser support is IE 9+
  • There will be one project level gobble file for building all CSS and JS

##Ractive Usage In order to keep the UI as responsive as possible, all concrete page elements should be defined in Vanilla HTML so they are presented immediatly without flicker. If that is not possible, then a placeholder HTML element should be created that will be replaced by the Ractive defined elements when they finish loading. This will prevent flickerinng and resizing of page elements on initial load.

Ractives should be as self contained as possible. Stay away from large global ractive elements, and make smaller, well defined ractive elements that are responsible for their own areas. This can be reconsidered if keeping two ractives separate creates a lot of complexity for sharing data.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Err404 = errors.New("Resource not found")

Err404 is a standard 404 error response

Functions

func StartServer

func StartServer(cfg *Config) error

StartServer Starts the townsourced webserver

Types

type Config

type Config struct {
	ReadTimeout string `json:"readTimeout"`

	WriteTimeout string `json:"writeTimeout"`

	MaxHeaderBytes    int    `json:"maxHeaderBytes"`
	MinTLSVersion     uint16 `json:"minTLSVersion"`
	CertFile          string `json:"certFile"`
	KeyFile           string `json:"keyFile"`
	Address           string `json:"address"`
	MaxUploadMemoryMB int    `json:"maxUploadMemoryMB"`

	DevMode   bool   `json:"-"`
	DemoMode  bool   `json:"-"`
	Zopfli    bool   `json:"-"`
	SubDomain string `json:"-"`
	// contains filtered or unexported fields
}

Config are the config values for starting up the webserver

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for the server layer

type JSend

type JSend struct {
	Status   string      `json:"status"`
	Data     interface{} `json:"data,omitempty"`
	Message  string      `json:"message,omitempty"`
	Failures []error     `json:"failures,omitempty"`
	More     bool        `json:"more,omitempty"` // more data exists for this request
}

JSend is the standard format for a response from townsourced

Jump to

Keyboard shortcuts

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