WARNING: Remember that Echo public fields and methods are coroutine safe ONLY when you are NOT mutating them
anywhere in your code after Echo server has started.
Error invokes the registered global HTTP error handler. Generally used by middleware.
A side-effect of calling global error handler is that now Response has been committed (sent to the client) and
middlewares up in chain can not change Response status code or Response body anymore.
Avoid using this method in handlers as no middleware will be able to effectively handle errors after that.
Instead of calling this method in handler return your error and let it be handled by middlewares or global error handler.
Parameters
err: Error
Returns void
file
file(file): void
File sends a response with the content of the file.
Parameters
file: string
Returns void
fileFS
fileFS(file, filesystem): void
FileFS sends a response with the content of the file from given filesystem.
RealIP returns the client's network address based on X-Forwarded-For
or X-Real-IP request header.
The behavior can be configured using Echo#IPExtractor.
Returns string
redirect
redirect(code, url): void
Redirect redirects the request to a provided URL with status code.
Parameters
code: number
url: string
Returns void
render
render(code, name, data): void
Render renders a template with data and sends a text/html response with status
code. Renderer must be registered using Echo.Renderer.
RouteInfo returns current request route information. Method, Path, Name and params if they exist for matched route.
In case of 404 (route not found) and 405 (method not allowed) RouteInfo returns generic struct for these cases.
Context represents the context of the current HTTP request. It holds request and response objects, path, path parameters, data and registered handler.