GithubHelp home page GithubHelp logo

sarvex / node.native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from d5/node.native

0.0 2.0 0.0 2.47 MB

C++11 port for the Node: native performance and modern simplicity.

License: MIT License

Makefile 2.29% C++ 94.57% C 0.44% Python 2.70%

node.native's Introduction

node.native

node.native is a C++11 (aka C++0x) port for node.js.

Please note that node.native project is under heavy development.

I'm working on the first release at v0.1.0 branch.

Sample code

Simplest web-server example using node.native.

#include <iostream>
#include <native/native.h>
using namespace native::http;

int main() {
    http server;
    if(!server.listen("0.0.0.0", 8080, [](request& req, response& res) {
        res.set_status(200);
        res.set_header("Content-Type", "text/plain");
        res.end("C++ FTW\n");
    })) return 1; // Failed to run server.

    std::cout << "Server running at http://0.0.0.0:8080/" << std::endl;
    return native::run();
}

Getting started

node.native consists of header files(*.h) only, but requires libuv and http-parser lib to use.

To compile included sample application(webserver.cpp) first run the following command in the project directory:

git submodule update --init

then,

make

alternatively you can set custom paths to http-parser and libuv if you dont want to use the submodules.

Tested on Ubuntu 11.10 and GCC 4.6.1. and OSX 10.8.2

Other Resources

node.native's People

Contributors

bluehaunter avatar d5 avatar dennycd avatar divanvisagie avatar kennethho avatar takano32 avatar tojocky avatar

Watchers

 avatar  avatar

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.