Full Stack Web App using Vue.js & Express.js: Part 2 - Sequelize

preview_player
Показать описание


Рекомендации по теме
Комментарии
Автор

From my observation, people are having issues with query at 14:30 not running / Cannot read property 'create' of undefined. 2 things to watch:
1) In your index.js make sure you have .filter(file => file !== "index.js') and not .filter(file => { file !== 'index.js'))
2) Try using const model = require(path.join(__dirname, file))(sequelize, Sequelize) instead of const model = sequelize.import(path.join(__dirname, file))
Another thing you might want to watch:
1) version compatibility of your node and sqlite
2) for message: "please install sqlite3 package manually", I'd suggesting uninstalling sequalize and sqlite and running: npm i sequalize sqlite3

kentarooka
Автор

Thanks for choosing SQL db, hard to find tutorials using SQL.

handle
Автор

For those who are starting there journey here please realize this is an old video, secondly an error that had me pulling my hair for a bit was ".create" is not a function, however it can be fixed by returning the User in user.js and by using this line : const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes), in index.js this will fix your issues with that as of 2023 sequelize, hopefully this helps someone. Keep on keepin on

nopenope
Автор

A couple of videos in and enjoying this series, thank you. Like the well paced instruction, demo and recap approach taken, and the fact you are taking time to show an iterative dev workflow with git, linting, tidy project setup and building on a SQL db.

Carl-yuuw
Автор

At 14:20 if you get a warning saying "sequelize depreciated String based operators are now deprecated. Please use Symbol based operators for better security" just put "operatorsAliases: false" in the options section of your config.js file.

AudioBassetHound
Автор

I was fixing error “sequelize is not a function” after googling I find the solution, I just replaced declare of model on line 20 with these:
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes)

ИванЖуравлёв-ут
Автор

Thank you for an impressive effort in this entire series of films. Real-time programming/execution with constructive and clear explanations and examples. Most educational sources are rewarding solely depending on how much you want/are willing to learn.

Those who did not like the movie/series would simply continue to watch cute kittens, sell cars/insurance, or whatever they are really doing ...

DusanStanic
Автор

at 13:47 I am getting the error after running 'TypeError: Cannot read property 'name' of undefined' in reference to 'db[model.name] = model' which makes sense to me, idk where it would come from

TechSquidTV
Автор

While repeating got an error “Joi.validate is not a function”
This is how I made it work:
first of all I changed declaration of schema like

const schema = Joi.object({
email: Joi.string().email(),
password: Joi.string().regex(
new RegExp(‘^[a-zA-Z0-9’{8, 32}$’)
)
})

Then I changed validation

const {error} = schema.validate(req.body)

ИванЖуравлёв-ут
Автор

For anyone having issues when working with the regular expressions during the validation with Joi. Try replacing the single quotes ( ' ) with a forward slash ( / ). Had this problem when working with Nuxt recently.

maskfultwitch
Автор

kind remainder for using newer version of Joi, Joi.validate() is being replaced by:



const schema = Joi.object({ name: Joi.string().min(6).required(),
email: Joi.string().min(6).required().email(),
password: Joi.string().required() });

const validation = schema.validate(req.body);
res.send(validation);

xinwang
Автор

This teaching would help a lot of us get a job. Thanks.

omotoshoisrael
Автор

Great job!!! You have helped me a lot. Your teaching style is truly appreciated.

tcsgraphics
Автор

I’m new to the whole full stack world, typically I just make programs with c, c#, Java, and I got a question. Is it normal to build web applications with so many dependencies? Just looking at your folder node-modules you have like 100 other dependencies.

Warpgatez
Автор

At 25:00 you have both the Controller and Policy in the routes.js file. This file could grow fairly large, if you have lots of controllers and policies. Is there a better way to organize/refactor this? Maybe creating a separate file for each controller/policy pair, then including/requiring/importing them into the main routes.js file? Is this something you can show in the next part?

slackergeek
Автор

I am having an error in which constraints stated in User.js file is not been applied on my input.
for Ex. Email should be unique, but it is even accepting duplicate emails. If anyone else also faced these errors kindly help.

rishidusad
Автор

At 21:35 in the video, I get a syntax error ----
async register (req, res) {

SyntaxError: Unexpected identifier
at (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

Did anyone have this problem? Everything was working fine before this.

ekeyur
Автор

I'm imaging that you're sipping on some tea with your pinky finger in the air when you said "Models" at 19:38 :D Great tutorial though

Ponpontutuss
Автор

Query not executing for me at 14:28. Server has started normally. No sqlite file was created.

megaheinhtetzaw
Автор

21:52 it is always returning a 400 status error

rishidusad
join shbcf.ru