Skip to content

kiritoxkiriko/comical

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comical

Comical is a lite web framework, focus on web serving and web application development.

This is a PRACTICE project, only for personal uses, DO NOT use it in production
This project mainly inspried by the blog 7days-golang - Gee.

Getting Started

install the package

go get github.com/kiritoxkiriko/[email protected]

serve a simple http router

package main

import (
	"log"
	"fmt"

	"github.com/kiritoxkiriko/comical"
	"github.com/kiritoxkiriko/comical/middleware"
)

func main() {
    r := comical.New()
    // use std logger
    logger := log.Default()
    
    // use build-in middleware
    r.Use(
		middleware.Recovery(logger),
		middleware.Logger(logger),
    )

    // register hello route
    r.GET("/hello", func(c *comical.Context) {
        name := c.Query("name")
        c.String(http.StatusOK, fmt.Sprintf("hello %s, u r at %s\n", name, c.Path))
    })

    // serve at localhost:8080
    if err := r.Run(":8080"); err != nil {
        logger.Fatal("failed to start")
    }
}

Usage

See examples

Features

  • RESTful API
  • Router
  • Group Control
  • Middleware
  • Template
  • Logger
  • Error Handling
  • Static File Server
  • Unit Test
  • Graceful Shutdown
  • Panic Recover

License

MIT License

About

Comical is a lite web framework written by Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published