webserver

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRouter

func AddRouter[T any](method string, path string, f func(ctx *HandlerContext[T]) (interface{}, error), decoderType ...T)

func CorrelationIDMiddleware

func CorrelationIDMiddleware(next http.Handler) http.Handler

func CorsMiddleware added in v2.10.0

func CorsMiddleware(next http.Handler) http.Handler

CorsMiddleware cria um middleware para tratar requisições CORS. Valida as origens, cabeçalhos e métodos permitidos nas requisições.

func HealthcheckHandler

func HealthcheckHandler(ctx *HandlerContext[any]) (interface{}, error)

func LanguageMiddleware added in v2.9.0

func LanguageMiddleware(next http.Handler) http.Handler

func MetricsHandler added in v2.8.2

func MetricsHandler(ctx *HandlerContext[interface{}]) (interface{}, error)

func MetricsHandlerAuthenticated added in v2.8.2

func MetricsHandlerAuthenticated(ctx *HandlerContext[interface{}]) (interface{}, error)

func PayloadMiddleware

func PayloadMiddleware(next http.Handler) http.Handler

func SwaggerHandler added in v2.7.0

func SwaggerHandler(ctx *HandlerContext[any]) (interface{}, error)

func UploadSizeExceededException added in v2.2.0

func UploadSizeExceededException(sizeLimit int64) *errors.CustomError

func WebserverDefaultRouter

func WebserverDefaultRouter()

Types

type APIResponse

type APIResponse struct {
	Data       interface{}
	StatusCode int
	Headers    map[string]string
}

type FileUpload added in v2.2.0

type FileUpload struct {
	Filename string
	Size     int64
	Content  []byte
}

type HandlerContext

type HandlerContext[T any] struct {
	Payload  T
	RawQuery string
	Headers  http.Header
	Request  *http.Request
	Response http.ResponseWriter
}

type WebServer

type WebServer struct {
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

func NewWebServer

func NewWebServer() *WebServer

func (*WebServer) Start

func (ws *WebServer) Start()

Jump to

Keyboard shortcuts

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