All Projects → metaleap → Go Leansite

metaleap / Go Leansite

[2013] a most minimalistic "dynamic-web-page" server written in Go (exploring the `net/http`, `html/template`, and Gorilla libs) ➜ both standalone or on AppEngine (served metaleap.net 2013 - 2016)

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Leansite

Pool2020
💼 Pools organized for Epitech's students in 2020.
Stars: ✭ 14 (-56.25%)
Mutual labels:  web-server
Hi Nginx
A fast and robust web server and application server for C++,Python,Lua ,Java,quickjs language
Stars: ✭ 346 (+981.25%)
Mutual labels:  web-server
Script Server
Web UI for your scripts with execution management
Stars: ✭ 506 (+1481.25%)
Mutual labels:  web-server
crab
🦀 a simple web server
Stars: ✭ 18 (-43.75%)
Mutual labels:  web-server
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (+821.88%)
Mutual labels:  web-server
Pi Timolo
Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.
Stars: ✭ 441 (+1278.13%)
Mutual labels:  web-server
Regulator
DIY Arduino consumption regulator build to use excess solar power for auxiliary 'summer' heating. The solar power data are retrieved over SunSpec Modbus TCP. IoT monitoring with Blynk and local Web server.
Stars: ✭ 32 (+0%)
Mutual labels:  web-server
Local Web Server
A lean, modular web server for rapid full-stack development.
Stars: ✭ 916 (+2762.5%)
Mutual labels:  web-server
Nock Nock
🚪 Monitor and validate your websites to maintain maximum uptime.
Stars: ✭ 339 (+959.38%)
Mutual labels:  web-server
0d1n
Tool for automating customized attacks against web applications. Fully made in C language with pthreads, it has fast performance.
Stars: ✭ 506 (+1481.25%)
Mutual labels:  web-server
IO.js
Library for async Javascript with support for error handling and recovery.
Stars: ✭ 18 (-43.75%)
Mutual labels:  web-server
Allmark
A cross-platform markdown web server
Stars: ✭ 284 (+787.5%)
Mutual labels:  web-server
Uwsgi Nginx Docker
Docker image with uWSGI and Nginx for applications in Python 3.5 and above and Python 2.7 (as Flask) in a single container. Optionally with Alpine Linux.
Stars: ✭ 466 (+1356.25%)
Mutual labels:  web-server
ck-web
Collective Knowledge web extension to browse CK repositories, visualize interactive graphs and articles, render CK-based websites, implement simple web services with JSON API (for example to crowdsource experiments or unify access to DNN). Demos of interactive articles, graphs and crowdsourced experiments:
Stars: ✭ 31 (-3.12%)
Mutual labels:  web-server
Unfiltered
A toolkit for servicing HTTP requests in Scala
Stars: ✭ 709 (+2115.63%)
Mutual labels:  web-server
blimp
Web development with docker made easy
Stars: ✭ 12 (-62.5%)
Mutual labels:  web-server
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ⚡️🦀
Stars: ✭ 401 (+1153.13%)
Mutual labels:  web-server
Caddy
Matthew Holt began developing Caddy in 2014 while studying computer science at Brigham Young University. (The name "Caddy" was chosen because this software helps with the tedious, mundane tasks of serving the Web, and is also a single place for multiple things to be organized together.) It soon became the first web server to use HTTPS automatically and by default, and now has hundreds of contributors and has served trillions of HTTPS requests.
Stars: ✭ 35,966 (+112293.75%)
Mutual labels:  web-server
Hestiacp
Hestia Control Panel | A lightweight and powerful control panel for the modern web.
Stars: ✭ 764 (+2287.5%)
Mutual labels:  web-server
Facebooc
Yet another Facebook clone written in C
Stars: ✭ 483 (+1409.38%)
Mutual labels:  web-server

leansite

-- import "github.com/metaleap/go-leansite"

A super-minimalistic "dynamic-web-page" server written in Go, just to explore the net/http, html/template, and Gorilla web packages.

The folder helloworld represents a sample LeanSite and can be used as a seed site:

  • run it standalone via go run $GOPATH/src/github.com/metaleap/go-leansite/helloworld/go-leansite-helloworld/main.go

  • run it on your Google App Engine SDK via dev_appserver.py $GOPATH/src/github.com/metaleap/go-leansite/helloworld

  • see it in action running on Google App Engine at http://go-leansite-helloworld.appspot.com/

Usage

var (
	//	To be set via Init(), see func Init() docs
	DirPath string

	//	Various file-system watchers, initialized by Init()
	DirWatch *ufs.Watcher

	//	Our request router, initialized by Init()
	Router *mux.Router

	//	Some site-specific data loaded from DirPath
	SiteData struct {
		//	Top-level navigation links loaded from contents/top.nav JSON file
		TopNav NavItems

		//	A map of blogs. Populated by PageContext.GetBlogArchive(), which is called from a template
		Blogs map[string]BlogNav
	}
)

func Init

func Init(dirPath string) (err error)

Stand-alone: call this in your main() before calling ListenAndServe().

App Engine: call this in your init() and DON'T call ListenAndServe().

dirPath: the site's base directory which contains folders "static", "contents" and "templates".

func ListenAndServe

func ListenAndServe(addr string) (err error)

addr: see http.Server.Addr

type BlogNav

type BlogNav struct {
	//	A chronological listing of blog entries
	Nav BlogNavItems
}

A chronological listing of blog entries

func (*BlogNav) ShowYear

func (me *BlogNav) ShowYear(year string) (dif bool)

Returns true if year is different than the value passed when this method was last called

type BlogNavItem

type BlogNavItem struct {
	//	Embedded navigation info (Href, Caption)
	NavItem

	//	Date posted
	Year, Month, Day string
}

Represents a blog entry

type BlogNavItems

type BlogNavItems []BlogNavItem

A collection of blog entries

func (BlogNavItems) Len

func (me BlogNavItems) Len() int

Implements sort.Interface.Len()

func (BlogNavItems) Less

func (me BlogNavItems) Less(i, j int) bool

Implements sort.Interface.Less()

func (BlogNavItems) Swap

func (me BlogNavItems) Swap(i, j int)

Implements sort.Interface.Swap()

type NavItem

type NavItem struct {
	//	Link attributes
	CssClass, Href, Caption, Desc string
}

A navigation link such as used in the sample site's top-navbar

func (*NavItem) IsActive

func (me *NavItem) IsActive(pc *PageContext) bool

Returns true if this NavItem points to the resource represented by pc, or an ancestor resource.

type NavItems

type NavItems []NavItem

A collection of navigation links

type PageContext

type PageContext struct {
	//	The underlying http.Request
	R *http.Request

	//	Host-relative Request URL path
	Path string

	//	Extracted from either SiteData.TopNav or the first <h2> occurence in the final HTML output
	PageTitle string

	//	Final HTML output
	HtmlContent template.HTML

	//	Always equivalent to SiteData.TopNav
	TopNav NavItems

	//	Contains the current year, for auto-updating copyright notices
	Year int
}

Represents a single page request, used as pipeline in main template

func NewPageContext

func NewPageContext(r *http.Request, path string) (me *PageContext)

Creates a new PageContext for the specified http.Request and host-relative request URL path

func (*PageContext) GetBlogArchive

func (me *PageContext) GetBlogArchive(path string) *BlogNav

Returns a BlogNav for the specified path. For example, GetBlogArchive("blog") maps to "contents/blog/"

-- godocdown http://github.com/robertkrimen/godocdown

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].