From 24116f5c60ddd677ee1a7c68d8a8fc140c747b3e Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 25 May 2025 15:27:52 +1200 Subject: [PATCH] Bug fixing --- src/server.cpp | 115 +------------------------------------------ src/welcome_page.cpp | 114 ++++++++++++++++++++++++++++++++++++++++++ src/welcome_page.hpp | 9 ++++ 3 files changed, 124 insertions(+), 114 deletions(-) create mode 100644 src/welcome_page.cpp create mode 100644 src/welcome_page.hpp diff --git a/src/server.cpp b/src/server.cpp index 8fa37ff..013cdb3 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -15,6 +15,7 @@ #include "string_utils.hpp" // Include the new utility header #include "put_handler.hpp" #include "utils.hpp" +#include "welcome_page.hpp" namespace simple_object_storage { @@ -140,120 +141,6 @@ void Server::stop() { } } -std::string welcome_page() { - return R"( - - - - - - Simple Object Storage - - - -
-
-

Simple Object Storage

-

A lightweight, efficient object storage service

-
- -
-
-

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) { diff --git a/src/welcome_page.cpp b/src/welcome_page.cpp new file mode 100644 index 0000000..9b8228e --- /dev/null +++ b/src/welcome_page.cpp @@ -0,0 +1,114 @@ +#include "welcome_page.hpp" + +namespace simple_object_storage { + +std::string welcome_page() { + return R"( + + + + + + Simple Object Storage + + + +
+
+

Simple Object Storage

+

A lightweight, simple object storage service

+
+ +
+
+

Simple Storage

+

Store and retrieve objects using unique hashes or label:tag combinations.

+
+
+

RESTful API

+

Access objects through a clean, intuitive REST API interface.

+
+
+ +
+

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
  • +
  • GET /meta/{hash} - Get object metadata
  • +
+
+
+ + +)"; +} + +} // namespace simple_object_storage \ No newline at end of file diff --git a/src/welcome_page.hpp b/src/welcome_page.hpp new file mode 100644 index 0000000..22cc719 --- /dev/null +++ b/src/welcome_page.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include + +namespace simple_object_storage { + +std::string welcome_page(); + +} // namespace simple_object_storage \ No newline at end of file