AddHTTPRoute adds a HTTP route to the entrypoint's server. If the server does not exist, it will be created, started and return any error.
(route types.HTTPRoute)
| 117 | // |
| 118 | // If the server does not exist, it will be created, started and return any error. |
| 119 | func (ep *Entrypoint) AddHTTPRoute(route types.HTTPRoute) error { |
| 120 | httpAddr, httpsAddr := getAddr(route) |
| 121 | var httpErr, httpsErr error |
| 122 | if httpAddr != "" { |
| 123 | httpErr = ep.addHTTPRoute(route, httpAddr, HTTPProtoHTTP) |
| 124 | } |
| 125 | if httpsAddr != "" { |
| 126 | httpsErr = ep.addHTTPRoute(route, httpsAddr, HTTPProtoHTTPS) |
| 127 | } |
| 128 | return errors.Join(httpErr, httpsErr) |
| 129 | } |
| 130 | |
| 131 | func (ep *Entrypoint) addHTTPRoute(route types.HTTPRoute, addr string, proto HTTPProto) error { |
| 132 | return ep.addHTTPRouteWithListener(route, addr, proto, nil) |
no test coverage detected