Code Monkey home page Code Monkey logo

orbit's Introduction

๐Ÿ’ซ Orbit ๐Ÿช

Version: 0.0.2

HTTP wrapper for net/http and go-chi/chi

Who is this for?

This library is for my personal usage and knowledge

Features [not all baked in yet]

  • Routing from go-chi/chi
    • chi router has been manually extended by orbit, will not be on the same track as the original project
    • all credit to pkieltyka
  • Context (Bits) wrapper
    • HTTP helper functions
    • HTML Template rendering
    • possible state injection
  • Handler returns an error

Is this production ready?

Sure :D - routing by chi and a couple extra helper methods; you can always manually write out your handler returns with the http.ResponseWriter and *http.Request structs

Installation

go get github.com/ArminasAer/orbit

Example

package main

import (
	"github.com/ArminasAer/orbit"
)

func main() {
	o := orbit.NewPlanet()

	o.Get("/", func(b orbit.Bits) error {
		return b.Text(200, "root")
	})

	o.Get("/{id}", idHandler)

	o.Launch("127.0.0.1:9000")
}

func idHandler(b orbit.Bits) error {
  id := orbit.URLParam(b.Request(), "id")

  return b.Text(200, id)
}

Inspired by:

  • Chi
    • it is built on top of the chi router
  • Echo
    • all handlers return an error
    • context interface paradigm
  • Fiber
    • simple design
    • helper functions
  • Express
    • express like patterns
  • Axum
    • axum global state management

orbit's People

Contributors

pheynnx avatar

Stargazers

 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.