#include<drogon/drogon.h>intmain(){//Set HTTP listener address and port//drogon::app().addListener("0.0.0.0",80);//Load config file#ifdefNDEBUGdrogon::app().loadConfigFile("./config.json");#elsedrogon::app().loadConfigFile("../../../config.json");#endifdrogon::app().run();return0;}配置文件初步介绍,进需要做如何配置
// 这一部分是http监听的端口和ip地址"listeners":[{//address: Ip address,0.0.0.0 by default"address":"0.0.0.0",//port: Port number"port":8080,//https: If true, use https for security,false by default"https":false}// ,// {// "address": "0.0.0.0",// "port": 443,// "https": true,// //cert,key: Cert file path and key file path, empty by default,0.0.1// //if empty, use the global setting// "cert": "",// "key": "",// //use_old_tls: enable the TLS1.0/1.1, false by default// "use_old_tls": false,// "ssl_conf": [// //["MinProtocol", "TLSv1.3"]// ]// }],//------------------// 这一部分是在程序中的配置文件部分需要使用app().getCustomConfig(),由getCustomConfig得到的变量直接["path"]就可以不需要["custom_config"]["path"]//custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method."custom_config":{"path":"D:/aaaa/bbb/","time":8,// 小时:文件名+~小时得到文件的生成时间}