GithubHelp home page GithubHelp logo

plenluno / libnode Goto Github PK

View Code? Open in Web Editor NEW
392.0 51.0 49.0 1.38 MB

C++ implementation of Node.js

License: BSD 2-Clause "Simplified" License

C++ 96.77% C 0.32% CMake 2.76% Shell 0.14% PowerShell 0.01%
nodejs c-plus-plus

libnode's Introduction

libnode

Build Status

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

Just like Node.js, libnode provides non-blocking I/O, which enables you to develop scalable Web applications in C++. libnode is faster and smaller than Node.js, so it is especially suitable for embedded devices.

Source Code

You need to clone all the dependant submodules to build libnode.

git clone --recursive https://github.com/plenluno/libnode.git

Build

Linux/Mac
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 ..

If you'd like to post messages to libnode from other threads in your application,

cmake -DLIBNODE_USE_THREAD=ON ..
Windows
tools/windows-cmake.ps1 [cmake-option ...]
Android
export ANDROID_NDK=/path/to/android-ndk
tools/android-cmake.sh [cmake-option ...]
iOS
tools/ios-cmake.sh [cmake-option ...]

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"));
node::run();

For more information about the usage, please refer to libnode/gtest.

libnode's People

Contributors

nlohmann avatar plenluno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libnode's Issues

building wrong

Building CXX object CMakeFiles/node.dir/src/fs/stats.cpp.o
[ 94%] Building CXX object CMakeFiles/node.dir/src/http.cpp.o
In file included from /root/libnode/include/libnode/detail/fs.h:11,
from /root/libnode/src/fs.cpp:3:
/root/libnode/include/libnode/detail/uv/fs_req.h: In constructor ‘libj::node::detail::uv::FsReq::FsReq(libj::JsFunction::Ptr)’:
/root/libnode/include/libnode/detail/uv/fs_req.h:17: wrong:class‘libj::node::detail::uv::FsReq’‘Req’ not be found

i use your provide command to building project.and i use centos 6.2,find this problem..how to slove?

Files missing while downloading the zip file

Appreciate the effort in bringing the node.js in C++. I tried downloading the zip format. while cmake - I was stopped with this error

CMake Error at CMakeLists.txt:382 (add_subdirectory):
The source directory
/home/john/Web/NODE/C++ IMPL/libnode-master/deps/libj
does not contain a CMakeLists.txt file.

Noticed that directories .../deps/libj , ../deps/openssl ... are empty. I am not sure if only my download has this issue. Any suggestion would help. ( while navigating under those directories in browser the files are present)

Thanks
John Paul.

HTTP Routing

Hey, very idea for a project! And I noticed it just now when I was thinking about running Node.JS on Android .. but the JIT restrictions wouldn't allow for it on non-rooted phones. Does your project allow for HTTP routing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.