8000 GitHub - kasulani/gofr: An opinionated Go framework for accelerated microservice development
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ gofr Public
forked from gofr-dev/gofr

An opinionated Go framework for accelerated microservice development

License

Notifications You must be signed in to change notification settings

kasulani/gofr

 
 

Repository files navigation

logo


Go Report Card Go Reference License

Gofr

Gofr is an opinionated microservice development framework. Visit https://gofr.dev for more details and documentation.

Goal

Even though generic applications can be written using Gofr, our main focus is to simplify the development of microservices. We will focus ourselves towards deployment in kubernetes and aspire to provide out-of-the-box observability.

Quick Start Guide

If you already have a go project with go module, you can get gofr by calling: go get gofr.dev. Follow the instructions below, if you are starting afresh.

The latest version of go in your system should be installed. If you have not already done that, install it from here. This can be tested by opening a terminal and trying go version. One should also be familiar with golang syntax. Official golang website has an excellent tour of go and is highly recommended.

Writing an API service using Gofr is very simple.

  1. In an empty folder, initialise your go module using: go mod init test-service. If you intend to push your code to github, it is recommended to name your module like this: go mod init github.com/{USERNAME}/{REPO}
  2. Create main.go file with following content:
package main

import "gofr.dev/pkg/gofr"

func main() {
    app := gofr.New()

    app.GET("/", func(ctx *gofr.Context) (interface{}, error) {
        return "Hello World!", nil
    })

    app.Start()
}
  1. Get all the dependencies using go get ./.... It will download gofr along with every other package it requires.
  2. Start the server: go run main.go It will start the server on default port 8000. If this port is already in use, you can override the default port by mentioning an environment variable like this: HTTP_PORT=9000 go run main.go

About

An opinionated Go framework for accelerated microservice development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.9%
  • HTML 0.1%
0