exports.subscribe = function (name, email) {
connectUser();
client.query("INSERT INTO subscriber (name, email) values($1, $2)", [name, email]);
}
exports.connectUser = pg.connect(conString, function(err, client, done) {
if(err) {
return console.error('error fetching client from pool', err);
}
client.query('CREATE TABLE IF NOT EXISTS subscriber (name varchar(64), email varchar(64))', function(err, result) {
done();
if(err) {
return console.error('error running query', err);
}
console.log(result.rows);
});
});
function addNewPost(request, response) {
var postsHTML = fs.readFileSync('views/post/posts.html');
response.writeHead(200, {
'content-type': 'text/html; charset=utf-8'
});
parseBody(request, function(body) {
db.connectUser();
db.subscribe(body.name, body.email);
});
response.end(postsHTML);
}
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/64430273-9418-4098-8bf2-a72bae248184%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
function addNewPost(request, response) {
var postsHTML = fs.readFileSync('views/post/posts.html');
response.writeHead(200, {
'content-type': 'text/html; charset=utf-8'
});
parseBody(request, function(body) {
pg.connect(conString, function(err, client, done) {
if(err) {
return console.error('error fetching client from pool', err);
}
client.query('CREATE TABLE IF NOT EXISTS subscriber (name varchar(64), email varchar(64))', function(err, result) {
client.query("INSERT INTO subscriber (name, email) values($1, $2)", [body.name, body.email]);
done();
if(err) {
return console.error('error running query', err);
}
console.log(result.rows);
});
});
});
response.end(postsHTML);
}
Sent from my LG Mobile
kurofune <jessel...@gmail.com> wrote:
>>> email to nodejs+un...@googlegroups.com <javascript:>.
>>> To post to this group, send email to nod...@googlegroups.com
>>> <javascript:>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/nodejs/64430273-9418-4098-8bf2-a72bae248184%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>
>--
>Job board: http://jobs.nodejs.org/
>New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
>Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>---
>You received this message because you are subscribed to the Google Groups "nodejs" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
>To post to this group, send email to nod...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b22e7431-b678-4823-8980-3535d5aa1151%40googlegroups.com.