Documentation
¶
Overview ¶
Package http provides Node.js http module equivalents for transpiled TypeScript code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONStringify ¶
JSONStringify converts a value to a JSON string.
Types ¶
type IncomingMessage ¶
type IncomingMessage struct {
Method string
URL string
Headers http.Header
// contains filtered or unexported fields
}
IncomingMessage wraps an HTTP request (Node.js http.IncomingMessage).
func (*IncomingMessage) Body ¶
func (m *IncomingMessage) Body() string
Body returns the request body as a string.
type RequestOptions ¶
RequestOptions holds options for http.request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps a Go HTTP server with Node.js-like API.
func CreateServer ¶
func CreateServer(handler func(req *IncomingMessage, res *ServerResponse)) *Server
CreateServer creates an HTTP server with the given handler.
type ServerResponse ¶
type ServerResponse struct {
// contains filtered or unexported fields
}
ServerResponse wraps an HTTP response writer (Node.js http.ServerResponse).
func (*ServerResponse) End ¶
func (r *ServerResponse) End(data ...string)
End finishes the response, optionally writing data.
func (*ServerResponse) SetHeader ¶
func (r *ServerResponse) SetHeader(key, value string)
SetHeader sets a response header.
func (*ServerResponse) Write ¶
func (r *ServerResponse) Write(data string)
Write writes data to the response.
Click to show internal directories.
Click to hide internal directories.