GorineeWeb

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 9 Imported by: 0

README

GorineeWeb 웹프레임워크 프로젝트

  1. 나만의 웹프레임쿼으 만들기 프로젝트입니다.

사용 라이브러리

  • github.com/valyala/fasthttp
  • github.com/fasthttp/router
  • github.com/prometheus/client_golang/prometheus/promhttp

해야할 것

  1. 라우터 생성하기
  2. 서버 실행하기
  3. GET 메소드 만들기
  4. POST 메소드 만들기
  5. PUT 메소드 만들기
  6. DELETE 메소드 만들기
  7. 라우터 그룹핑 만들기
  8. 속도 + 동시접속 가능하게 개선해보기
  9. 웹소켓 코드 만들기
  10. SSL 인증 관련 코드 만들기
  11. 토큰 발급 코드 만들기

진행상황 및 피드백

  • 현재 New를 통해 서버 실행되는 거 확인
  • 서버 실행 시, GorineeWeb과 버전 출력 뛰어주기 완료
  • 메소드와 연결되는 핸들러 만들기 완료
  • Get Mapping 완료
  • query and param 구현 완료
  • middleware 구성 진행중
  • 라우터 그룹핑 필요

Documentation

Index

Constants

View Source
const (
	Get     METHOD = "GET"     // RFC 7231, 4.3.1
	Head           = "HEAD"    // RFC 7231, 4.3.2
	Post           = "POST"    // RFC 7231, 4.3.3
	Put            = "PUT"     // RFC 7231, 4.3.4
	Patch          = "PATCH"   // RFC 5789
	Delete         = "DELETE"  // RFC 7231, 4.3.5
	Connect        = "CONNECT" // RFC 7231, 4.3.6
	Options        = "OPTIONS" // RFC 7231, 4.3.7
	Trace          = "TRACE"   // RFC 7231, 4.3.8
)
View Source
const (
	Continue           STATUS = 100 // RFC 7231, 6.2.1
	SwitchingProtocols        = 101 // RFC 7231, 6.2.2
	Processing                = 102 // RFC 2518, 10.1

	OK                   = 200 // RFC 7231, 6.3.1
	Created              = 201 // RFC 7231, 6.3.2
	Accepted             = 202 // RFC 7231, 6.3.3
	NonAuthoritativeInfo = 203 // RFC 7231, 6.3.4
	NoContent            = 204 // RFC 7231, 6.3.5
	ResetContent         = 205 // RFC 7231, 6.3.6
	PartialContent       = 206 // RFC 7233, 4.1
	MultiStatus          = 207 // RFC 4918, 11.1
	AlreadyReported      = 208 // RFC 5842, 7.1
	IMUsed               = 226 // RFC 3229, 10.4.1

	MultipleChoices  = 300 // RFC 7231, 6.4.1
	MovedPermanently = 301 // RFC 7231, 6.4.2
	Found            = 302 // RFC 7231, 6.4.3
	SeeOther         = 303 // RFC 7231, 6.4.4
	NotModified      = 304 // RFC 7232, 4.1
	UseProxy         = 305 // RFC 7231, 6.4.5

	TemporaryRedirect = 307 // RFC 7231, 6.4.7
	PermanentRedirect = 308 // RFC 7538, 3

	BadRequest                   = 400 // RFC 7231, 6.5.1
	Unauthorized                 = 401 // RFC 7235, 3.1
	PaymentRequired              = 402 // RFC 7231, 6.5.2
	Forbidden                    = 403 // RFC 7231, 6.5.3
	NotFound                     = 404 // RFC 7231, 6.5.4
	MethodNotAllowed             = 405 // RFC 7231, 6.5.5
	NotAcceptable                = 406 // RFC 7231, 6.5.6
	ProxyAuthRequired            = 407 // RFC 7235, 3.2
	RequestTimeout               = 408 // RFC 7231, 6.5.7
	Conflict                     = 409 // RFC 7231, 6.5.8
	Gone                         = 410 // RFC 7231, 6.5.9
	LengthRequired               = 411 // RFC 7231, 6.5.10
	PreconditionFailed           = 412 // RFC 7232, 4.2
	RequestEntityTooLarge        = 413 // RFC 7231, 6.5.11
	RequestURITooLong            = 414 // RFC 7231, 6.5.12
	UnsupportedMediaType         = 415 // RFC 7231, 6.5.13
	RequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4
	ExpectationFailed            = 417 // RFC 7231, 6.5.14
	Teapot                       = 418 // RFC 7168, 2.3.3
	UnprocessableEntity          = 422 // RFC 4918, 11.2
	Locked                       = 423 // RFC 4918, 11.3
	FailedDependency             = 424 // RFC 4918, 11.4
	UpgradeRequired              = 426 // RFC 7231, 6.5.15
	PreconditionRequired         = 428 // RFC 6585, 3
	TooManyRequests              = 429 // RFC 6585, 4
	RequestHeaderFieldsTooLarge  = 431 // RFC 6585, 5
	UnavailableForLegalReasons   = 451 // RFC 7725, 3

	InternalServerError           = 500 // RFC 7231, 6.6.1
	NotImplemented                = 501 // RFC 7231, 6.6.2
	BadGateway                    = 502 // RFC 7231, 6.6.3
	ServiceUnavailable            = 503 // RFC 7231, 6.6.4
	GatewayTimeout                = 504 // RFC 7231, 6.6.5
	HTTPVersionNotSupported       = 505 // RFC 7231, 6.6.6
	VariantAlsoNegotiates         = 506 // RFC 2295, 8.1
	InsufficientStorage           = 507 // RFC 4918, 11.5
	LoopDetected                  = 508 // RFC 5842, 7.2
	NotExtended                   = 510 // RFC 2774, 7
	NetworkAuthenticationRequired = 511 // RFC 6585, 6
)
View Source
const (
	Version = "0.0.1 alpha" // Version of GorineeWeb
	Name    = "GorineeWeb"  // Name of GorineeWeb

)

Exported constants

Variables

This section is empty.

Functions

func Custom

func Custom(server *fasthttp.Server) *gorineeWeb

custom

func GetString

func GetString(b []byte) string

GetString gets the content of a string as a []byte without copying #nosec G103

func InterfaceConvertString

func InterfaceConvertString(arg interface{}) string

func New

func New() *gorineeWeb

Types

type GorineeWeb

type GorineeWeb interface {
	Get(path string, handler Handler)
	Post(path string, handler Handler)
	Put(path string, handler Handler)
	Delete(path string, handler Handler)
	Head(path string, handler Handler)
	New() *gorineeWeb
	Custom(server *fasthttp.Server) *gorineeWeb
	Run(addr string)
	HealthCheck()
	// contains filtered or unexported methods
}

type GorineeWebContext

type GorineeWebContext interface {
	SetCookie(key, value string, expireAt time.Time, httpOnly, secure bool) bool
	GetCookie(key string) string
	Body() string
	Query(key string) string
	Param(key string) interface{}
	Reply(contentType string, data []byte)
	ReplyJSON(data interface{})
}

type Handler

type Handler func(*gorineeWebContext)

type METHOD

type METHOD string

type Route

type Route struct {
	Method  METHOD
	Path    string
	Handler Handler
}

type STATUS

type STATUS int

type Settings

type Settings struct {

	// Enables automatic recovering from panic while executing handlers by
	// answering with HTTP status code 500 and logging error message without
	// stopping service
	AutoRecover bool // default false

	// ServerName for sending in response headers
	ServerName string // default ""

	// Maximum request body size
	MaxRequestBodySize int // default 4 * 1024 * 1024

	// Maximum number of route params count
	MaxRouteParams int // default 1024

	// Max request url length
	MaxRequestURLLength int // default 2048

	// Enable case sensitive routing
	CaseInSensitive bool
}

Jump to

Keyboard shortcuts

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