Connection to database and receiving error: database does not exist

736 Views Asked by At

So I am new to ReactJS and trying to connect to a Postgres Database on my local machine. I'm using Axios and Massive V2. Attempting to run my server.js file I am receiving the following error message in Terminal:

(node:989) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): error: database "hosers_and_hoseheads" does not exist

Here's the Axios call I'm sending to my DB:

axios.post('http://localhost:9000/api/blog_post', { title: 'Your Team Name Sucks' }).then(function(response) {
    console.log('This is the response: ', response.data);
    alert(response.data)
});

Here is the connection string in my server.js file:

var conn = massive.connectSync({
  connectionString : 'postgres://postgres:@localhost:3736/hosers_and_hoseheads'
});

Any help would be awesome. Thanks!

0

There are 0 best solutions below