<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
const express = require('express');
const bodyParser = require('body-parser');
const bcrypt = require('bcrypt-nodejs');
const cors = require('cors');
const knex = require('knex');
const register = require('./controllers/register');
const signin = require('./controllers/signin');
const profile = require('./controllers/profile');
const image = require('./controllers/image');
const db = knex({
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'postgres',
password : '',
database : 'smart-brain'
}
});
const app = express();
app.use(cors());
app.use(bodyParser.json());
app.get('/', (req, res)=> {res.send(database.users) })
app.post('/signin', signin.handleSignin(db,bcrypt))
app.post('/register', (req, res) => {register.handleRegister(req, res, db, bcrypt) })
app.get('/profile/:id', (req, res)=> {profile.handleProfileGet(req, res, db)})
app.put('/image', (req, res) => {image.handleImage(req, res, db)})
app.listen(3000, ()=> {
console.log('app is running on port 3000');
})
Sounds like a database credentials issue. It looks like you have "" for a password and you're using postgres for you database. You might want to recheck that your superuser(postgres) does not have a password or reset it.
You might also check to see if you have coded any conditional process.env USER and PASSWORD variables in your app that. If you have then you will have to assign those variables in your .env file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With