Skip to content
NodePP library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dependent_projects
include
src
tests
unused
web_files
.clang-format
.editorconfig
.gitignore
CMakeLists.txt
LICENSE
Readme.md
file_db.json
make_deps.sh
test_ssl_static_service_config.json
test_static_service_config.json
test_template.shtml
test_template_ts.shtml
test_web_site_config.json

Readme.md

A high level library to let me do asynchronous c++ programming like that done in Node.js.

#include <cstdlib>

#include "base_work_queue.h"
#include "lib_http_request.h"
#include "lib_http_site.h"
#include "lib_http_static_service.h"

int main( int argc, char const **argv ) {
	using namespace daw::nodepp;
	using namespace daw::nodepp::lib::net;
	using namespace daw::nodepp::lib::http;

	auto site = create_http_site( );
	site->on_listening( []( EndPoint endpoint ) {
				std::cout << "Node++ Static HTTP Server\n";
				std::cout << "Listening on " << endpoint << '\n';
			} )
			.on_error( []( base::Error error ) {
				std::cerr << "Error: ";
				std::cerr << error << '\n';
			} )
			.listen_on( 8080 );

	auto service = create_static_service( "/", "./web_files" );
	service->connect( site );

	base::start_service( base::StartServiceMode::OnePerCore );
	return EXIT_SUCCESS;
}

As you can see, one can create a static web server quickly and succinctly. Currently, the library focus is on networking and HTTP networking. Other async tasks will be added, such as Sqlite support as I need them. The tests folder contains more examples.

You can’t perform that action at this time.