diff --git a/lib/author.js b/lib/author.js index 950419d..9b30b33 100644 --- a/lib/author.js +++ b/lib/author.js @@ -1,6 +1,7 @@ var db = require('./db'); var template = require('./template.js'); var qs = require('querystring'); +var url = require('url'); exports.home = function(request, response){ db.query(`SELECT * FROM topic`, function(error,topics){ @@ -26,7 +27,7 @@ exports.home = function(request, response){
- +
`, @@ -58,4 +59,48 @@ exports.create_process = function(request, response){ } ) }); +} + +exports.update = function(request, response){ + db.query(`SELECT * FROM topic`, function(error,topics){ + db.query(`SELECT * FROM author`, function(error2,authors){ + var _url = request.url; + var queryData = url.parse(_url, true).query; + db.query(`SELECT * FROM author WHERE id=?`,[queryData.id], function(error3,author){ + var title = 'author'; + var list = template.list(topics); + var html = template.HTML(title, list, + ` + ${template.authorTable(authors)} + + + `, + `` + ); + response.writeHead(200); + response.end(html); + }); + + }); + }); } \ No newline at end of file diff --git a/lib/template.js b/lib/template.js index 015d750..d71e100 100644 --- a/lib/template.js +++ b/lib/template.js @@ -49,7 +49,7 @@ module.exports = {