UNPKG

newswriter

Version:

NewsWriter is a generic tool for maintaining news and announcements on a website news page. Details are held in an SQLite database, from which the tool generates the index page (typically the top page of the target site), individual pages for events and a

24 lines (21 loc) 855 B
(function () { var cogClass = function () {}; cogClass.prototype.exec = function (params, request, response) { var oops = this.sys.apiError; var sys = this.sys; var personID = params.personid; var sql = 'SELECT name,contact,affiliation,position ' + 'FROM persons ' + 'JOIN names USING(nameID) ' + 'JOIN contacts USING(contactID) ' + 'JOIN affiliations USING(affiliationID) ' + 'JOIN positions USING(positionID) ' + 'WHERE personID=?'; sys.db.get(sql,[personID],function(err,row){ if (err) {return oops(response,err,'event/getoneperson(1)')}; response.writeHead(200, {'Content-Type': 'application/json'}); response.end(JSON.stringify(row)); }); } exports.cogClass = cogClass; })();