Giter VIP home page Giter VIP logo

hydra's Introduction

hydra

hydra 是基于 go 语言和众多开源项目实现的分布式微服务框架

hydra['haɪdrə]致力于提供统一的,丰富功能的后端开发框架,降低后端开发的复杂性,提高开发效率。目前已支持的服务类型有:http api服务,rpc服务,websocket服务,mqc消息消费服务,cron定时任务服务,web服务,静态文件服务。

特性

  • 后端一体化框架, 支持 6+服务器类型
  • 微服务的基础设施, 服务注册发现,熔断降级,集成监控与统一配置管理
  • 多集群模式支持,对等,主备,分片等
  • 丰富的后端库支持 redis,memcache,activieMQ,mqtt,influxdb,mysql,oracle,elasticsearch,jwt 等等
  • 跨平台支持(linux,macOS 10.9+,windows 7+)
  • 20+线上项目实践经验
  • 全 golang 原生实现

示例

  1. 编写代码

新建文件夹hello,并添加main.go文件,输入以下代码:

package main

import (
	"github.com/micro-plat/hydra/context"
	"github.com/micro-plat/hydra/component"
	"github.com/micro-plat/hydra/hydra"
)

func main() {
	app := hydra.NewApp(
		hydra.WithPlatName("myplat"), //平台名称
		hydra.WithSystemName("demo"), //系统名称
		hydra.WithClusterName("test"), //集群名称
		hydra.WithServerTypes("api"), //服务器类型为http api
		hydra.WithRegistry("fs://../")) //使用本地文件系统作为注册中心

	app.API("/hello",hello)
	app.Start()
}

func hello(ctx *context.Context) (r interface{}) {
	return "hello world"
}
  1. 编译生成服务
go install hello
  1. 安装本地服务和生成注册中心配置
hello install
  1. 运行服务
./hello run
  1. 测试服务
curl http://localhost:8090/hello

{"data":"hello world"}

hydra 微服务开发入门

hydra 微服务开发规范

构建 API 服务一

构建 API 服务二

构建消息消费服务(MQC)

构建任务调度服务(CRON)

构建远程调用服务(RPC)

构建静态文件服务

构建 websocket 服务(WS)

安全认证(jwt,数字摘要,远程认证)

性能指标收集(metric)

日志配置与管理

hydra's People

Contributors

arsgo avatar zkfy 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.