Giter VIP home page Giter VIP logo

app-2's Introduction

app

Reusable framework for Go apps & command line tools

Features

  • HTTP router
  • GraphQL
  • GRPC
  • Database migration
  • Environmental variables
  • JWT
  • Email API
  • Timer
  • Logger
  • Terminal GUI

Build your first scalable web service

  1. Create routing.go with the following content:

    package main
    
    import (
    	"fmt"
    	"net/http"
    
    	"github.com/short-d/app/fw/router"
    	"github.com/short-d/app/fw/service"
    )
    
    func main() {
    	routes := []router.Route{
    		{
    			Method:      http.MethodGet,
    			MatchPrefix: false,
    			Path:        "/:name",
    			Handle: func(w http.ResponseWriter, r *http.Request, params router.Params) {
    				name := params["name"]
    				page := fmt.Sprintf(`<h1>Hello, %s!<h1>`, name)
    				w.Write([]byte(page))
    			},
    		},
    	}
    
    	routingService := service.
    		NewRoutingBuilder("Example").
    		Routes(routes).
    		Build()
    
    	routingService.StartAndWait(8080)
    }
  2. Start the service using this command:

    go run routing.go
  3. That's it! You can now visit the web page at http://localhost:8080/Gopher!

More Examples

Projects using app

  • Short: Easy to use URL shortening service
  • Kgs: Distributed unique key generation service

Contributing

When contributing to this repository, please first discuss the change you wish to make via Slack channel with the owner of this repository before making a change.

Please open a draft pull request when you are working on an issue so that the owner knows it is in progress. The owner may take over or reassign the issue if no body replies after ten days assigned to you.

Pull Request Process

  1. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
  2. You may merge the Pull Request in once you have the sign-off of code owner, or if you do not have permission to do that, you may request the code owner to merge it for you.

Code of Conduct

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Discussions

Please join this Slack channel to discuss bugs, dev environment setup, tooling, and coding best practices.

Author

Harry Liu - byliuyang

License

This project is maintained under MIT license.

app-2's People

Contributors

coderworld10 avatar arberiii avatar alldroll avatar krtbgb avatar

Watchers

James Cloos 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.