Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d5/node.native
C++11 port for the Node: native performance and modern simplicity.
https://github.com/d5/node.native
Last synced: 12 days ago
JSON representation
C++11 port for the Node: native performance and modern simplicity.
- Host: GitHub
- URL: https://github.com/d5/node.native
- Owner: d5
- License: mit
- Created: 2012-02-03T07:29:57.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2016-06-10T22:27:47.000Z (over 8 years ago)
- Last Synced: 2024-04-14T10:02:42.671Z (7 months ago)
- Language: C++
- Homepage:
- Size: 8.95 MB
- Stars: 1,159
- Watchers: 87
- Forks: 149
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node.native
node.native is a [C++11](http://en.wikipedia.org/wiki/C%2B%2B11) (aka C++0x) port for [node.js](https://github.com/joyent/node).
Please note that node.native project is under heavy development.
I'm working on the first release at [v0.1.0](https://github.com/d5/node.native/tree/v0.1.0) branch.
## Sample code
Simplest web-server example using node.native.
```cpp
#include
#include
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 startednode.native consists of header files(*.h) only, but requires [libuv](https://github.com/joyent/libuv) and [http-parser](https://github.com/joyent/http-parser) lib to use.
To compile included sample application(webserver.cpp) first run the following command in the project directory:
```bash
git submodule update --init
```
then,
```bash
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
- [Mailing list](http://groups.google.com/group/nodenative)
- [Public to-to lists](https://trello.com/b/1qk3tRGS)