HttpServer.hpp 983 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __HTTPSERVER_HPP_
  2. #define __HTTPSERVER_HPP_
  3. #include <iostream>
  4. #include "UtilBase.hpp"
  5. #include "Util/logger.h"
  6. #include <httplib.h>
  7. #include "config.hpp"
  8. #include "Expel.hpp"
  9. using namespace std;
  10. using namespace toolkit;
  11. namespace gsd{
  12. class HttpServer: public ModuleBase
  13. {
  14. private:
  15. HttpServer(): ModuleBase(){
  16. }
  17. public:
  18. using Ptr = std::shared_ptr<HttpServer>;
  19. /**
  20. * @description: CreateNew
  21. * @return {*}
  22. */
  23. static std::shared_ptr<HttpServer> CreateNew();
  24. ~HttpServer(){}
  25. /**
  26. * @description: Init
  27. * @return {*}
  28. */
  29. virtual bool Init();
  30. /**
  31. * @description: Destroy
  32. * @return {*}
  33. */
  34. virtual void Destroy();
  35. protected:
  36. /**
  37. * @brief 服务
  38. */
  39. std::shared_ptr<httplib::Server> m_server = nullptr;
  40. };
  41. }
  42. #endif