so i asked for help a couple of days ago to help design a schema for a project i am building and after some recommendations to postgres( i already was trying to use postgres but couldnt work it) i decided to spend 3 day fixing the problem, the solution was pretty easy and got it working on a localhost, however when i launch it on heroku i get this errorbtw this is just a tester to get me used to postgresqlconst express = require("express"); const pg = require("pg"); const connect = "postgres://user:user@localhost/karls" const router = express.Router(); const pool = new pg.Client(process.env.DATABASE_URL || connect); pool.connect(); router.route("/").get((req, res) => { pool.query("SELECT * FROM Recipe", function(err, result) { if(err) console.error(err); console.log(result.rows) < -- error occurs here res.render("home", {results: result.rows}); }); }) this is the heroku log:error: relation "recipe" does not exist i dont understand why recipe doesnt exist since i created it with pgadmin ? i think it might be to do with "process.env.DATABASE_URL" but im not entirely sure.
Submitted May 06, 2018 at 09:34PM by SeanCarroll17
No comments:
Post a Comment