Git Product home page Git Product logo

postgres-express-node-tutorial's Introduction

Getting Started With Node, Express and Postgres (using Sequelize)

This repo houses code for the blog "Getting Started with Node, Express and Postgres (using Sequelize)"

Code for various sections is separated into branches, so if you're working through the tutorial and you get stuck, you can always checkout the corresponding branch and refer.

Have fun! 😄

postgres-express-node-tutorial's People

Contributors

keiclone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postgres-express-node-tutorial's Issues

SequelizeConnectionError

Hi there, thanks for the tutorial!

Seems that I'm getting an incorrect response when using postman to update a todo or any action (apart from a GET on the /api).

I noticed this after following the tutorial through, so thought I must have messed up somewhere. To double-check I downloaded this repo and ran the app (after running the sequelize db:migrate command). Still seem to be getting the wrong response back, compared with what the tutorial suggests I should be getting back.

Example:

GET http://127.0.0.1:8000/api/todos
(using Postman, no headers or auth set)

Response:

    "name": "SequelizeConnectionError",
    "parent": {
        "name": "error",
        "length": 99,
        "severity": "FATAL",
        "code": "28000",
        "file": "miscinit.c",
        "line": "502",
        "routine": "InitializeSessionUserId"
    },
    "original": {
        "name": "error",
        "length": 99,
        "severity": "FATAL",
        "code": "28000",
        "file": "miscinit.c",
        "line": "502",
        "routine": "InitializeSessionUserId"
    }

Am I missing something here? Any help very welcome!

Error when creating todo items

Hi, I read your tutorial and I love it.
I'm getting this error in the section for creating todo items:

"parent": {
"name": "error",
"length": 128,
"severity": "ERROR",
"code": "42703",
"position": "31",
"file": "parse_target.c",
"line": "954",
"routine": "checkInsertTargets",
"sql": "INSERT INTO "TodoItems" ("id","content","complete","createdAt","updatedAt","todoId") VALUES (DEFAULT,'',false,'2017-10-08 19:33:17.599 +00:00','2017-10-08 19:33:17.599 +00:00','1') RETURNING *;"

SequelizeDatabaseError

Nice tutorial sir, but i am getting Dequelize DatabaseError while trying to request localhost:8000/api/todos in postman. The below is the output

{
"name": "SequelizeDatabaseError",
"parent": {
"name": "error",
"length": 115,
"severity": "ERROR",
"code": "42P01",
"position": "13",
"file": "src\backend\parser\parse_relation.c",
"line": "984",
"routine": "parserOpenTable",
"sql": "INSERT INTO "Todos" ("id","title","createdAt","updatedAt") VALUES (DEFAULT,'first-todo','2017-06-15 06:11:49.889 +00:00','2017-06-15 06:11:49.889 +00:00') RETURNING *;"
},
"original": {
"name": "error",
"length": 115,
"severity": "ERROR",
"code": "42P01",
"position": "13",
"file": "src\backend\parser\parse_relation.c",
"line": "984",
"routine": "parserOpenTable",
"sql": "INSERT INTO "Todos" ("id","title","createdAt","updatedAt") VALUES (DEFAULT,'first-todo','2017-06-15 06:11:49.889 +00:00','2017-06-15 06:11:49.889 +00:00') RETURNING *;"
},
"sql": "INSERT INTO "Todos" ("id","title","createdAt","updatedAt") VALUES (DEFAULT,'first-todo','2017-06-15 06:11:49.889 +00:00','2017-06-15 06:11:49.889 +00:00') RETURNING *;"
}

Can you please help me out to resolve this error. Thank you

TypeError: Cannot read property 'create' of undefined

When trying to create the controllers for creating new todos I get the following error: "TypeError: Cannot read property 'create' of undefined" when calling the API from Postman.

The part of the code where the error happens:
module.exports = {
create(req, res) {
return Todo
.create({ # This is the problem part
title: req.body.title,
})
.then(todo => res.status(201).send(todo))
.catch(error => res.status(400).send(error));
},
};

I'm not super familiar with ES6 syntax so I really don't know if I need to refactor this code

".all() is not a function” error

Regarding the server/controllers/todos.js snippet in the Listing todos section, “.all()” should be replaced with “.findAll()” - at least that resolved my “.all() is not a function” error.

Best practices for accessing postgres functions

Hi,
This is not an issue. Just a question.

Are there any best practices where to keep the files which access the postgres functions/stored procedures in your project? I liked the best practices mentioned here. Would like to know about functions.
Regards,
Manik Mittal

TodoId null

Testing the API route for creating new todo items, the todoId field is null and I've followed every step of the tutorial but can't debug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.