server method
Implementation
Future<HttpServer> server([String host = '0.0.0', int port = 4000]) async {
return await shelf_io.serve(
const shelf.Pipeline()
.addMiddleware(_errorMiddleware())
.addMiddleware(_corsMiddleware())
.addMiddleware(shelf.logRequests())
.addHandler((req) async {
final response = await router.call(req);
return response.change(headers: {
...response.headers,
if (!req.url.path.endsWith('.tar.gz'))
HttpHeaders.contentTypeHeader: unpuberServerVersion,
HttpHeaders.acceptEncodingHeader: '*',
..._corsHeaders
});
}),
host,
port);
}