jweb

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 12 Imported by: 0

README

Jweb

This is a Symfony(https://symfony.com/) inspired framework, written in Go.

It is a work in progress and any contributions are welcomed.

Todo

  • module mechanism
  • yaml config files and separate config files for each module
  • module config structure
  • maybe move database module to different repository
  • resolve config.yaml params based on .env params

Usage

  • the doc folder contains .dist files with example configurations
package main

import (
    `time`

    `github.com/gin-gonic/gin`
    `gitlab.com/drjele-go/jweb`
    command `gitlab.com/drjele-go/jweb/cli/command`
    jwebresponse `gitlab.com/drjele-go/jweb/http/response`
    route `gitlab.com/drjele-go/jweb/http/routing/route`
)

func main() {
    var commandList command.List

    j := jweb.New(getRouteList(), commandList)

    j.Run()
}

func getRouteList() route.List {
    routeList := route.List{}

    routeList = append(
        routeList,
        route.New(
            route.MethodGet,
            `/`,
            func(context *gin.Context) jwebresponse.Response {
                payload := jwebresponse.JsonPayload{`time`: time.Now()}

                response := jwebresponse.NewJson(context)

                response.SetPayload(payload)

                return response
            },
        ),
    )

    return routeList
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Jweb

type Jweb struct {
	// contains filtered or unexported fields
}

func New

func New(
	moduleList jwebmodule.List,
) *Jweb

func (*Jweb) GetKernel

func (j *Jweb) GetKernel() *jwebkernel.Kernel

func (*Jweb) GetModule

func (j *Jweb) GetModule(name string) jwebmodule.Module

func (*Jweb) Run

func (j *Jweb) Run()

func (*Jweb) SetCommandList

func (j *Jweb) SetCommandList(commandList command.List)

func (*Jweb) SetRouteList

func (j *Jweb) SetRouteList(routeList route.List)

Jump to

Keyboard shortcuts

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