Giter VIP home page Giter VIP logo

gofr's Introduction

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

gofr's People

Contributors

aryanmehrotra avatar dependabot[bot] avatar stella551 avatar umang01-hash avatar vikash avatar

Stargazers

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