0

Im trying to get my server up and running and connected to my postgres db but I keep getting this error:

rs/Desktop/Jobletics/models/employer.js:7
        username: DataTypes.STRING,
                           ^
TypeError: Cannot read property 'STRING' of undefined

Here is the code in gist:

https://gist.github.com/rahul1346/cb8e93796c8af9ebd77e

What am I passing incorrectly?

1 Answer 1

1

DataTypes is undefined. It doesn't exist. Go back through your code to where it came from and find out why.

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

4 Comments

I get a blank screen when I go to your link to look at the code. Also, you might have defined DataTypes, but value was ever assigned to it, or the value was removed.
Thank you. gist.github.com/rahul1346/cb8e93796c8af9ebd77e That is the gist...it should work. Where do you generally assign the value? Isnt it supposed to be passed thru when the route is called?
Okay, was able to get in. Not a sequelize expert, we only used it for a little while, and then switched to using Mongo. Looking at the docs for sequelize, it looks like it's just a convenience class, but they are not clear about where it comes from. It also states that you can probably just use 'STRING'. sequelize.readthedocs.org/en/latest/api/datatypes/…. Looking at these docs, it's almost as though it can only be used when defining the model itself.
Interesting. Thinking of just doing this in Mongo myself. But this app im trying to build will have many relational dependencies.

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.