main.cc 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * @Author: error: git config user.name && git config user.email & please set dead value or install git
  3. * @Date: 2022-07-10 16:35:47
  4. * @LastEditors: lishengyin
  5. * @LastEditTime: 2022-08-04 15:08:37
  6. * @FilePath: /gsd/main.cc
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. #include <drogon/drogon.h>
  10. #include "Util/logger.h"
  11. #if defined(ENABLE_MYSQL)
  12. #include "Util/SqlPool.h"
  13. #endif
  14. using namespace std;
  15. using namespace toolkit;
  16. int main()
  17. {
  18. //初始化日志
  19. Logger::Instance().add(std::make_shared<ConsoleChannel> ());
  20. //Set HTTP listener address and port
  21. drogon::app().addListener("0.0.0.0",9080);
  22. //Load config file
  23. #ifndef RELEASE
  24. drogon::app().loadConfigFile("../config.json");
  25. #else
  26. drogon::app().loadConfigFile("../config/config.json");
  27. #endif
  28. //Run HTTP framework,the method will block in the internal event loop
  29. drogon::app().run();
  30. return 0;
  31. }