chibaba / connec Goto Github PK
View Code? Open in Web Editor NEWSequelizing nodejs API from the backend with postgresql
Sequelizing nodejs API from the backend with postgresql
Line 45 in 0cdf40f
The idea is to have the DB autogenerate unique IDs.
Line 120 in 0cdf40f
Instead of throwing error, just return res.status(500).json({ message: 'Error logging in', error: err });
Line 20 in 0cdf40f
type: Sequelize.UUIDV4
to do ID autogeneration and then, there will be no need for autoIncrement
.
Check http://docs.sequelizejs.com/manual/tutorial/models-definition.html for insights
Line 80 in 0cdf40f
Check Sequelize docs to see what type of error is returned when uniqueness rule fails. Just testing if err
catches all error even if DB failure and the user gets incorrect response.
Line 66 in 7845d22
Instead of /user/sign up
, you can have /user/signup
or /user/sign_up
. Just NEVER use space.
Line 3 in 7845d22
Prepend const
Line 129 in 0cdf40f
Please test every endpoint to see it does what you intend it to do.
Line 44 in 7845d22
since it's an id, it's safe to define auto-increment
rule, check sequelize docs to see how. Then you can just create a new user without having to specify the id and it gets automatically added.
Line 94 in 0cdf40f
Is the export necessary ? Please let me know what you are trying to do here.
Line 21 in 7845d22
Just use 1
Line 26 in 0cdf40f
Please setup unique rule for the email
field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.