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
{ | |
"targets": [ | |
{ | |
"target_name": "addon", | |
"sources": [ | |
"addon.cc", | |
], | |
"include_dirs": ["<!(node -e \"require('nan')\")","/opt/ibm/domino/notesapi/include"], | |
"libraries": [ "/opt/ibm/domino/notes/latest/linux/libnotes.so"], | |
"defines": [ "GCC3", "GCC4","ND64","NDUNIX64", "UNIX", "LINUX64","LINUX", "LINUX86","W32","LINUX86_64", "W","GCC_LBLB_NOT_SUPPORTED","LONGIS64BIT","DTRACE", "PTHREAD_KERNEL" "_REENTRANT", "USE_THREADSAFE_INTERFACES","_POSIX_THREAD_SAFE_FUNCTIONS","HANDLE_IS_32BITS", "HAS_IOCP", "HAS_BOOL", "HAS_DLOPEN", "USE_PTHREAD_INTERFACES", "LARGE64_FILES", "_LARGEFILE_SOURCE", "_LARGEFILE64_SOURCE","PRODUCTION_VERSION", "OVERRIDEDEBUG"], |
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
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var app = express(); | |
app.use(bodyParser.json()); | |
var Pool = require("odbc").Pool | |
var pool = new Pool(); | |
var cn = "DSN=Notes"; | |
app.use(express.static(__dirname + '/public')); |
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
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var app = express(); | |
app.use(bodyParser.json()); | |
var Pool = require("odbc").Pool | |
var pool = new Pool(); | |
var cn = "DSN=Notes"; | |
app.use(express.static(__dirname + '/public')); |
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
app.delete('/api/v1/todos/:todo_id', function(req, res) { | |
var id = req.params.todo_id; | |
pool.open(cn, function (err,db) { | |
if (err) { | |
return console.log(err); | |
} | |
db.query("DELETE FROM Todo WHERE NoteUNID = '"+id+"'", function (err, rows, moreResultSets) { | |
if (err) { | |
return console.log(err); | |
} |
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
app.put('/api/v1/todos/:todo_id', function(req, res) { | |
var id = req.params.todo_id; | |
var data = {todoText: req.body.todoText, todoComplete: req.body.todoComplete }; | |
pool.open(cn, function (err,db) { | |
if (err) { | |
return console.log(err); | |
} | |
db.query("UPDATE Todo SET todoText='"+data.todoText+"',todoComplete='"+data.todoComplete+ "' WHERE NoteUNID='"+id+"';", function (err, rows, moreResultSets) { | |
if (err) { |
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
app.post('/api/v1/todos', function(req,res) { | |
var data = {todoText: req.body.todoText, complete: false}; | |
pool.open(cn, function (err,db) { | |
if (err) { | |
return console.log(err); | |
} | |
db.query("INSERT INTO Todo (todoText,todoComplete) VALUES('"+data.todoText+"','"+data.complete+"')", function (err, rows, moreResultSets) { | |
if (err) { | |
return console.log(err); |
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
var db = require('odbc')() | |
, cn = "DSN=Notes" | |
; | |
db.open(cn, function (err) { | |
if (err) return console.log(err); | |
db.query("select * from todos", function (err, rows, more) { | |
if (err) return console.log(err); | |
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
app.get('/api/v1/todos', function(req, res) { | |
pool.open(cn, function (err,db) { | |
if (err) { | |
return console.log(err); | |
} | |
db.query("select * from todos", function (err, rows, moreResultSets) { | |
if (err) { | |
return console.log(err); | |
} | |
res.json(rows); |