<commit_before>libnode
=======

[![Build Status](https://travis-ci.org/plenluno/libnode.png?branch=master)](https://travis-ci.org/plenluno/libnode)

libnode is a native implementation of Node.js.

### Build

    git clone --recursive https://github.com/plenluno/libnode.git
    mkdir libnode/build
    cd libnode/build
    cmake ..
    make

The memory management of libnode is automatic, based on either shared_ptr or bdw-gc.  
libnode uses shared_ptr by default. In order to use bdw-gc,  

    cmake -DLIBNODE_USE_BDWGC=ON ..

### Example

The following HTTP server responds with "Hello World" for every request.

    auto srv = http::Server::create(
        JsClosure::create([] (JsArray::Ptr args) {
            auto res = args->getPtr<http::ServerResponse>(1);
            res->setHeader(http::HEADER_CONTENT_TYPE, str("text/plain"));
            res->end(str("Hello World\n"));
            return UNDEFINED;
        }));
    srv->listen(1337, str("127.0.0.1"));<commit_msg>s/native/C++/<commit_after>libnode
=======

[![Build Status](https://travis-ci.org/plenluno/libnode.png?branch=master)](https://travis-ci.org/plenluno/libnode)

libnode is a C++ implementation of Node.js.

### Build

    git clone --recursive https://github.com/plenluno/libnode.git
    mkdir libnode/build
    cd libnode/build
    cmake ..
    make

The memory management of libnode is automatic, based on either shared_ptr or bdw-gc.  
libnode uses shared_ptr by default. In order to use bdw-gc,  

    cmake -DLIBNODE_USE_BDWGC=ON ..

### Example

The following HTTP server responds with "Hello World" for every request.

    auto srv = http::Server::create(
        JsClosure::create([] (JsArray::Ptr args) {
            auto res = args->getPtr<http::ServerResponse>(1);
            res->setHeader(http::HEADER_CONTENT_TYPE, str("text/plain"));
            res->end(str("Hello World\n"));
            return UNDEFINED;
        }));
    srv->listen(1337, str("127.0.0.1"));
{'fraction_non_alphanumeric': 0.14373401534526853, 'fraction_numerical': 0.011253196930946292, 'mean_word_length': 3.1092436974789917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '34780', 'n_tokens_mistral': 660, 'n_tokens_neox': 635, 'n_words': 149}