diff --git a/src/server.cpp b/src/server.cpp
index 2235bce..8fa37ff 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -140,6 +140,120 @@ void Server::stop() {
}
}
+std::string welcome_page() {
+ return R"(
+
+
+
+
+
+ Simple Object Storage
+
+
+
+
+
+
+
+
+
Simple Storage
+
Store and retrieve objects using unique hashes or label:tag combinations.
+
+
+
RESTful API
+
Access your objects through a clean, intuitive REST API interface.
+
+
+
Secure Access
+
Protected endpoints with token-based authentication for write operations.
+
+
+
+
+
Available Endpoints
+
+ GET /object/{hash}
- Retrieve an object by hash
+ GET /hash/{label:tag}
- Get hash for a label:tag
+ GET /exists/{hash}
- Check if an object exists
+ GET /dir
- List all objects
+ PUT /upload
- Upload a new object
+ GET /meta/{hash}
- Get object metadata
+
+
+
+
+
+)";
+}
+
void Server::setup_routes() {
// Add CORS preflight handler for all routes
server_.Options(".*", [this](const httplib::Request& req, httplib::Response& res) {
@@ -151,14 +265,14 @@ void Server::setup_routes() {
add_cors_headers(req, res);
});
- const std::string welcome_page = "simple_object_storage Template Registry
";
+
// Welcome page
- server_.Get("/", [welcome_page](const httplib::Request&, httplib::Response& res) {
- res.set_content(welcome_page, "text/html");
+ server_.Get("/", [](const httplib::Request&, httplib::Response& res) {
+ res.set_content(welcome_page(), "text/html");
});
- server_.Get("/index.html", [welcome_page](const httplib::Request&, httplib::Response& res) {
- res.set_content(welcome_page, "text/html");
+ server_.Get("/index.html", [](const httplib::Request&, httplib::Response& res) {
+ res.set_content(welcome_page(), "text/html");
});
// Get object by hash or label:tag