Giter VIP home page Giter VIP logo

pepsi's Introduction

Pepsi Web Framework

Pepsi是跟随7days-golang开发的简单Web框架,并在此基础上增添了自己的想法,也算是学习了Gin框架的原理。

Feature

  • 前缀树Trie作为路由功能
  • handlerChain实现与业务逻辑无关的功能拓展
  • 提供路由分组中间件控制,实现基于基底路径的逻辑划分。如/api下提供A中间件,而user提供B中间件功能。

Further

  • 使用自己实现的net/http库作为基础网络API

Installation

环境需安装Go 1.16以上,然后执行:

$ go get -u github.com/peanutzhen/pepsi

Quick start

$ cat example.go

example.go输出如下:

package main

import (
	"fmt"
	"net/http"

	"github.com/peanutzhen/pepsi"
)

func main() {
	r := pepsi.CreateEngine()
	r.GET("/hello", func(c *pepsi.Context) {
		c.HTML(http.StatusOK, "<h1>Hello world!</h1>")
	})
	err := r.Run(":8080")
	if err != nil {
		fmt.Println(err)
	}
}

运行HTTP服务进程:

$ go run example.go

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.