webapp

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

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

Go to latest
Published: Sep 4, 2021 License: MIT Imports: 11 Imported by: 0

README

Webapp

GoDoc

Warning

This repository is experimental and opinionated. You should not rely on it for production unless you are prepared to keep up with breaking changes.

About

There is a lot of common code that goes with building web applications in Go. While this is fine when that is your primary job it can make building hobby sites or just experimenting much slower and more tedious. Webapp attempts to improve that situation but this is an experiment. Also, the code will be opinionated and my opinions may not match yours.

Example

package main

import (
	"log"

	"github.com/gofiber/fiber/v2"
	"github.com/sfreiberg/webapp"
)

func main() {
	app := webapp.New()

	app.Get("/", func(c *fiber.Ctx) error {
		return c.SendString("Hello, World 👋!")
	})

	if err := app.Run(); err != nil {
		log.Fatalf("Error starting web app: %s\n", err)
	}
}

Usage

NAME:
   your-app - Built with github.com/sfreiberg/webapp

USAGE:
   your-app [global options] command [command options] [arguments...]

COMMANDS:
   generate, g  Generators
   routes       Display routes
   server, s    Start web server
   tasks, t     Display tasks
   help, h      Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Webapp

type Webapp interface {
	Use(args ...interface{}) fiber.Router

	Get(path string, handlers ...fiber.Handler) fiber.Router
	Head(path string, handlers ...fiber.Handler) fiber.Router
	Post(path string, handlers ...fiber.Handler) fiber.Router
	Put(path string, handlers ...fiber.Handler) fiber.Router
	Delete(path string, handlers ...fiber.Handler) fiber.Router
	Connect(path string, handlers ...fiber.Handler) fiber.Router
	Options(path string, handlers ...fiber.Handler) fiber.Router
	Trace(path string, handlers ...fiber.Handler) fiber.Router
	Patch(path string, handlers ...fiber.Handler) fiber.Router

	Add(method, path string, handlers ...fiber.Handler) fiber.Router
	Static(prefix, root string, config ...fiber.Static) fiber.Router
	All(path string, handlers ...fiber.Handler) fiber.Router

	Group(prefix string, handlers ...fiber.Handler) fiber.Router

	Mount(prefix string, fiber *fiber.App) fiber.Router

	Run() error
	AddTasks(...*cli.Command)
}

func New

func New() Webapp

Jump to

Keyboard shortcuts

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