This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = { | |
entry: path.resolve(__dirname, '../index.js'), | |
output: { | |
path: path.resolve(__dirname, '../build'), | |
filename: 'bundle.js' | |
}, | |
devtool: 'eval', | |
devServer: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
*.log | |
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//index.js | |
const testAddon = require('./build/Release/testaddon.node'); | |
module.exports = testAddon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/binding.gyp b/binding.gyp | |
index 23b9976..2d188af 100644 | |
--- a/binding.gyp | |
+++ b/binding.gyp | |
@@ -4,7 +4,8 @@ | |
"cflags!": [ "-fno-exceptions" ], | |
"cflags_cc!": [ "-fno-exceptions" ], | |
"sources": [ | |
- "cppsrc/main.cpp" | |
+ "cppsrc/main.cpp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cppsrc/Samples/functionexample.cpp b/cppsrc/Samples/functionexample.cpp | |
index 0bd9bc2..37b7eb9 100644 | |
--- a/cppsrc/Samples/functionexample.cpp | |
+++ b/cppsrc/Samples/functionexample.cpp | |
@@ -4,13 +4,33 @@ std::string functionexample::hello(){ | |
return "Hello World"; | |
} | |
+int functionexample::add(int a, int b){ | |
+ return a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* cppsrc/Samples/actualclass.cpp */ | |
#include "actualclass.h" | |
ActualClass::ActualClass(double value){ | |
this->value_ = value; | |
} | |
double ActualClass::getValue() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/binding.gyp b/binding.gyp | |
index 2d188af..031bf18 100644 | |
--- a/binding.gyp | |
+++ b/binding.gyp | |
@@ -5,7 +5,9 @@ | |
"cflags_cc!": [ "-fno-exceptions" ], | |
"sources": [ | |
"cppsrc/main.cpp", | |
- "cppsrc/Samples/functionexample.cpp" | |
+ "cppsrc/Samples/functionexample.cpp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const style = require('ansi-styles'); | |
const express = require('express'); | |
const hello = () =>` | |
${style.green.open}Hello Green!${style.green.close} | |
${style.red.open}Hello Red!${style.red.close} | |
`; | |
const app = express(); | |
app.get('/hello', (req, res) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const { Readable } = require('stream'); | |
// This is the special ANSI code to tell terminals to clear the screen | |
const PAGE_BREAK = '\033[2J\033[H'; | |
// This function gets the current date in string format along | |
// with a page break on top. | |
// Note that you would need to add a new line for the terminal to | |
// interpret it. That is `hello` will not work while `hello\n` will. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const hello = require('./src/ansi/animations/hello'); | |
const PORT = process.env.PORT || 3000; | |
const app = express(); | |
// simple hello route | |
app.get('/hello', async (req, res, next) => { | |
const userAgent = req.headers['user-agent']; // checking the useragent |
OlderNewer