master
Chunting Gu 5 years ago
parent 4ddf2d5696
commit 4386c46397

@ -5,15 +5,6 @@
#include "book_client.h"
// Memory leak detection with VLD.
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >")
#include "vld/vld.h"
#pragma comment(lib, "vld")
#endif
#endif
// -----------------------------------------------------------------------------
void PrintSeparator() {
@ -56,7 +47,7 @@ int main(int argc, char* argv[]) {
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE_FILE_OVERWRITE);
BookClient client(url);
BookClient client{ url };
PrintSeparator();

@ -6,15 +6,6 @@
#include "views.h"
// Memory leak detection with VLD.
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >")
#include "vld/vld.h"
#pragma comment(lib, "vld")
#endif
#endif
int main(int argc, char* argv[]) {
if (argc < 3) {
std::cout << "usage: book_server <port> <upload_dir>" << std::endl;
@ -43,7 +34,7 @@ int main(int argc, char* argv[]) {
std::cout << "Book photos will be saved to: " << photo_dir << std::endl;
try {
webcc::Server server(port); // No doc root
webcc::Server server{ port }; // No doc root
server.Route("/books",
std::make_shared<BookListView>(),

@ -40,9 +40,11 @@ int main(int argc, const char* argv[]) {
LOG_USER("Sleep seconds: %d", sleep_seconds);
try {
webcc::Server server(8080);
webcc::Server server{ 8080 };
server.Route("/", std::make_shared<HelloView>(sleep_seconds));
auto view = std::make_shared<HelloView>(sleep_seconds);
server.Route("/", view);
server.Route("/hello", view);
server.Run(workers);

@ -17,7 +17,7 @@ int main() {
WEBCC_LOG_INIT("", webcc::LOG_CONSOLE);
try {
webcc::Server server(8080);
webcc::Server server{ 8080 };
server.Route("/", std::make_shared<HelloView>());

@ -23,7 +23,7 @@ int main(int argc, char* argv[]) {
std::string doc_root = argv[2];
try {
webcc::Server server(port, doc_root);
webcc::Server server{ port, doc_root };
if (argc == 4) {
server.set_file_chunk_size(std::atoi(argv[3]));

Loading…
Cancel
Save