0

I am new to both Nodejs and Postgres. I am attempting to build a small node application using express to just connect to a postgres DB and do a simple query. I found this guide, https://node-postgres.com/, and have installed this pg package.

I cut and pasted the first block of code into my method, and it won't run. It is crashing at the following line. If I take the await keyword out completely and start the server, it runs, but the query doesn't work.

 await client.connect()
1

1 Answer 1

1

the await keyword is new in node version 7.6. Try running node -v to see what version of node you're currently using. If it's less than 7.6, you'll probably need to update in order to use await.

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

1 Comment

The await became available by default since Node 7.6. Before that parameter --harmony could enable it.

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.