0

I'm just starting with Node.js and I'm following this tutorial https://dev.to/glaucia86/developing-a-crud-node-js-application-with-postgresql-4c9o

when setting .env file as suggested

DATABASE_URL=postgres://{db_username}:{db_password}@{host}:{port}/{db_name}

so


DATABASE_URL=postgres://vinnytwice:pass@localhost:5432/fixit

I start the server with npm start command when using Postman to send a Post request I get they error in console:

vinnytwice@Vinnys-iMac fixit_server_node % npm start

> [email protected] start
> node server.js

App executing to port  3000
error: database "vinnytwice" does not exist
    at Parser.parseErrorMessage (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:369:20)
    at addChunk (node:internal/streams/readable:313:12)
    at readableAddChunk (node:internal/streams/readable:288:9)
    at Socket.Readable.push (node:internal/streams/readable:227:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

What am I doing wrong ? Many thanks.

1 Answer 1

1

Finally found the problem, the .env file wasn't at the root of the project.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.