This commit is contained in:
@@ -153,25 +153,10 @@ void Server::setup_routes() {
|
||||
});
|
||||
|
||||
|
||||
// Welcome page
|
||||
server_.Get("/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
if (req.path == "/") {
|
||||
res.set_content(welcome_page(), "text/html");
|
||||
return;
|
||||
}
|
||||
// if the path is not /, then it's a hash or label:tag
|
||||
handle_get_object(req, res);
|
||||
});
|
||||
|
||||
server_.Get("/index.html", [](const httplib::Request&, httplib::Response& res) {
|
||||
res.set_content(welcome_page(), "text/html");
|
||||
});
|
||||
|
||||
// Get object by hash or label:tag
|
||||
server_.Get("/object/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
handle_get_object(req, res);
|
||||
});
|
||||
|
||||
// Get hash for label:tag
|
||||
server_.Get("/hash/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
handle_get_hash(req, res);
|
||||
@@ -218,6 +203,22 @@ void Server::setup_routes() {
|
||||
server_.Get("/status", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
res.set_content(nlohmann::json({{"result", "success"}, {"status", "ok"}}).dump(), "application/json");
|
||||
});
|
||||
|
||||
// Get object by hash or label:tag
|
||||
server_.Get("/object/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
handle_get_object(req, res);
|
||||
});
|
||||
|
||||
// Welcome page and download object.
|
||||
server_.Get("/(.*)", [this](const httplib::Request& req, httplib::Response& res) {
|
||||
if (req.path == "/") {
|
||||
res.set_content(welcome_page(), "text/html");
|
||||
return;
|
||||
}
|
||||
// if the path is not /, then it's a hash or label:tag
|
||||
handle_get_object(req, res);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void Server::handle_cors_preflight(const httplib::Request& req, httplib::Response& res) {
|
||||
|
Reference in New Issue
Block a user