Course Solutions Uncategorized (Solved) : Need Change Database Mongo Postgresql Server Anything Would Help Thanks Server Code Consol Q26227928 . . . .

(Solved) : Need Change Database Mongo Postgresql Server Anything Would Help Thanks Server Code Consol Q26227928 . . . .

 

I need to change my database from a mongo to aPostgreSQL server. Anything would help thanks.

SERVER CODE:

console.log(‘Server-side code running’);

const express = require(‘express’);
const MongoClient = require(‘mongodb’).MongoClient;

const app = express();

app.use(express.static(‘public’));

let db;

const url = ‘mongodb://localhost:27017/clicks’;

MongoClient.connect(url, (err, database) => {
if (err) {
return console.log(err);
}
db = database;
// start the express web server listening on 8080
app.listen(8080, () => {
console.log(‘listening on 8080’);
});
});

app.get(‘/’, (req, res) => {
res.sendFile(__dirname + ‘/index.html’);
});

app.post(‘/clicked’, (req, res) => {
db.collection(‘clicks’).findOneAndUpdate({}, {$inc: {click : 1}},(err, result) => {
if(err) throw err;
res.send(result);
});
});

//console.log(click);
//console.log(db);

// db.collection(‘clicks’).save(click, (err, result) =>{
// if (err) {
// return console.log(err);
// }
// console.log(‘click added to db’);
// res.sendStatus(201);
// });
// });

app.get(‘/clicks’, (req, res) => {
db.collection(‘clicks’).findOne({ “myId” : “skylar” },function(err,result){
if (err) return

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post