Giter Club home page Giter Club logo

geex's Introduction

geex

一个go语言编写的web框架,基于极客兔兔的《Go语言动手写Web框架》和极客时间的《手把手带你写一个Web框架》。

启动服务器

// 启动框架默认服务器
e := framework.Default()

路由结构

内容详解:https://ecj6xn2q3r.feishu.cn/docx/WhdWdAkiXoO0lQxVt3ycCVUkn9b 使用了前缀树作为路由解析的结构

  • 添加路由
e := framework.Default()
e.Get("/assets/*filepath", func(c *framework.Context) {
//...
})
  • 路由组
v1 := e.Group("/v1")
	{
		v1.Get("/hello", func(c *framework.Context) {
			//...
		})
	}
  • 路由参数解析
    参数解析功能实现了:param*参数的解析
e.Get("/hello/:name", func(c *framework.Context) {
			c.String(http.StatusOK, "hello %s, you're at %s\n", c.Param("name"), c.Path)
		})
e.Get("/hello/student/*", func(c *framework.Context) {
           //...
})

WebSocket功能支持

该功能的实现基本移植了nhooyr/websocket的功能,正在完成中

实现服务容器

  • 框架提供服务容器功能
  • 每个服务都是一个服务提供者
  • 每个服务都需要想框架注册
  • 由框架控制服务的实例化
  • 调用服务功能时从容器获取服务示例,再调用服务的具体功能

涉及具体功能:

配置文件读取

教材中的配置文件读取的实现基本仿照了开源库viper,本项目在此基础上依照viper实现了读取远程配置的 能力,相较于教材中读取本地配置的功能,读取远程配置在实际开发中的应用范围更广。读取远程配置的接口与viper项目相同。

geex's People

Contributors

hiholder avatar

Watchers

 avatar

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.