public static IRestFulServer Create(IRestFulSettings settings, Action <IContainer> register) { IContainer container = _createContainer(); register?.Invoke(container); container.Register((_) => settings); RestFulRegistration.RegisterComponents(container); return(container.Resolve <IRestFulServer>()); }
public RestFulServer(IRestFulSettings settings, IRestFulLogger logger, ISerializer serializer, IHttpListener httpListener, IRouter router) { _uriBuilder = new UriBuilder { Host = settings.Host, Port = settings.Port, Scheme = (settings.UseHTTPs) ? "https" : "http" }; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _httpListener = httpListener ?? throw new ArgumentNullException(nameof(httpListener)); _router = router ?? throw new ArgumentNullException(nameof(router)); }