gorge

package module
v0.0.0-...-e05ab31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

gorge

gorge

gorge is a web development DSL for go. It is simple and easy-to-use. It is currently in beta, and is going to have new features soon, such as authentication. You can find out ways to contribute at the end of this README.

Installation

Use the go get CLI command to install gorge.

go get -u github.com/cococats/gorge

Usage

Connections

All functions will post to localhost:6789 unless otherwise specified through end

Functions

say(value): Use say to print text. The URL will parse to: localhost:6789.

get(url): Use get to get a HTTP request. The URL will parse to: localhost:6789/get.

put("PUT", value, body): Use put to put a HTTP request. The URL will parse to: localhost:6789/put.

post(url, contentType, body): Use post to post a HTTP Request.

method(method, value, body): Use method to get and post a HTTP method such as patch.

end(): Use end to start a connection to localhost:6789. This is required for your application to work!

do(value):Use do to perform tasks not listed above.

Decoding from Template Files

decodexml(file): Decodexml decodes an XML (.xmL) file.

decodejson(file): Decodejson decodes a JSON (.json) file.

decodepem(file): Decodepem decodes an PEM (.pem) file.

Example

Example using get and say:


package main

import (
"github.com/cococats/gorge"
)

func main() {
   get("http://localhost:6789")
   say("hello world")
   end()
}

A More Advanced Example
import "GitHub.com/cococats/gorge"

func main() {

say("Hello World")
get("github.com/cococats/gorge")
post("localhost:6789", "img/jpg", nil)
end()

Contributing

Pull requests are welcome. For major changes not specified below, please open an issue first to discuss what you would like to change. Currently, these are the next steps for gorge:

  • HTTP Authorization.

Please feel free to add those features in a seperate doc.

Please make sure to update tests as appropriate.

License

Apache 2.0

Documentation

Index

Constants

View Source
const (
	MethodGet     = "GET"
	MethodHead    = "HEAD"
	MethodPost    = "POST"
	MethodPut     = "PUT"
	MethodPatch   = "PATCH" // RFC 5789
	MethodDelete  = "DELETE"
	MethodConnect = "CONNECT"
	MethodOptions = "OPTIONS"
	MethodTrace   = "TRACE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL