示例#1
0
文件: main.c 项目: trumae/Shared-Wifi
int main(void){
	struct mg_server *server;

    // Start network configurations
    setup_ap();
    setup_dhcp();
    setup_iptables();

	// Create and configure the server
	server = mg_create_server(NULL, ev_handler);
	mg_set_option(server, "document_root", ".");
	mg_set_option(server, "listening_port", "8080");

	init_routes_table();
	init_resources_table();

	set_path_404("/404.html");
	set_path_index("/index.html");

	// Serve request. Hit Ctrl-C to terminate the program
	printf("Starting on port %s\n", mg_get_option(server, "listening_port"));
	for (;;) {
		mg_poll_server(server, 1000);
	}

	// Cleanup, and free server instance
	mg_destroy_server(&server);

    return 0;
}
示例#2
0
int main(void) {
    struct mg_server *server;

    //Start network configurations
    //setup_ap();
    //setup_dhcp();
    //setup_iptables();

    // Create and configure the server
    server = mg_create_server(NULL, ev_handler);
    mg_set_option(server, "document_root", ".");
    mg_set_option(server, "listening_port", "8080");

    limparRotas();
    init_resources_table();

    criar_tabela();

    //registra a rota do log do cliente
    add_route("/login", handle_post_request);

    // Serve request. Hit Ctrl-C to terminate the program
    printf("Starting on port %s\n", mg_get_option(server, "listening_port"));
    for (;;) {
        mg_poll_server(server, 1000);
    }

    // Cleanup, and free server instance
    mg_destroy_server(&server);
    return 0;
}