forked from freezer333/cppwebify-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
53 lines (46 loc) · 1.59 KB
/
Copy pathindex.js
File metadata and controls
53 lines (46 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.use(express.static('public'));
app.set('view engine', 'jade');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
var types = [
{
title: "pure_node",
description: "Execute a really primitive implementation of prime sieve in Node.js"
},
{
title: "standalone_args",
description: "Execute C++ executable as a child process, using command line args and stdout. Based on /cpp/standalone_stdio"
},
{
title: "standalone_usr",
description: "Execute C++ executable as a child process, using direct user input. Based on /cpp/standalone_usr"
},
{
title: "standalone_file",
description: "Execute C++ executable as a child process, using an input and output file. Based on /cpp/standalone_flex_file"
},
{
title: "ffi",
description: "Using Node Foreign Function Interface (ffi) to call C++ code. Based on /cpp/lib4ffi"
},
{
title: "addonsync",
description: "Creating a Synchronous Node Addon that can be called like any other module. Based on /cpp/nodeprime_sync"
},
{
title: "addon",
description: "Creating a Asynchronous Node Addon that can be called like any other module. Based on /cpp/nodeprime"
}
];
types.forEach(function (type) {
app.use('/'+type.title, require('./routes/' + type.title));
});
app.get('/', function (req, res) {
res.render('index', { routes: types});
});
var server = app.listen(3000, function () {
console.log('Web server listing at http://localhost:%s', server.address().port);
});