for thos who got error in ...model.prototype.save() no longer accepts a callback instead of this: 👇👇👇 author.save((err,newAuthor)=>{ if(err){ res.render('authors/new',{ author: author, errMessage:'Error Creating Author...' }) }else{ res.render('authors') } }) use this:👇👇👇 author.save(). then((newAuthor)=>{ res.render('authors') }). catch((err)=>{ res.render('authors/new',{ author: author, errMessage:'Error Creating Author...' }) }) Best Go... ! 👍
@trentasaurus Жыл бұрын
Thank you!
@vadimsmamedovs10 ай бұрын
thanks
@SolveForBetter8 ай бұрын
Much obliged : )
@dupolo53582 ай бұрын
worked here, thanks
@learningwithtabrez3 жыл бұрын
Excellent brother, no one can give such knowledge in such a simple and easy way..
@holup50353 жыл бұрын
This is my 4th day of learning back end webdev and this code and code from last episode works fine for me buuuut I understand a null from this 😅 I hope in like month or so I can go back to this comment and fairy reply to it as I understand and can create simply fullstack website on my own. :D
@IGIRIIS2 жыл бұрын
Every thing is named author or authors that is confusing and hard to understand for complete beginner , but still it's a great course
@Antel_0074 ай бұрын
Please try to update this playlist
@nithinkottary95784 жыл бұрын
can we do the html part using front end?
@MonsterFishKeepersPH2 жыл бұрын
WTF just happened, the only problem was const Author, the Author's color was null and when I deleted the name and retype Author again the program worked fine now. can someone explain what happened? I even undid the steps to make sure if it was really spelled Author in the first place and it really was! What happened?
@mamusthafa62 жыл бұрын
Getting this error... { %> authors.forEach is not a function
@tobyapellido15272 жыл бұрын
you missed a - inside your ejs logic,
@javhaasuhochir81262 жыл бұрын
did you find your solution? I am getting that error too.
@trendingtopics2888 Жыл бұрын
@@javhaasuhochir8126 Did you find solution authors.forEach is not a function I am getting that error too.
@trendingtopics2888 Жыл бұрын
Did you find solution authors.forEach is not a function I am getting that error too.
@surfinbird714 жыл бұрын
If you get the "errorMessage is not defined" error don't freak out. As he explains late in the video you can put this in errorMessage.ejs:
@miralpankhania39834 жыл бұрын
Thank you so much for help!!
@sagar_khanapurkar4 жыл бұрын
Thank you!
@tejasjoshi19074 жыл бұрын
I am getting TypeError: cannot read the property ' name ' of undefined Why? Can u please pleaee help mee
@claudiutamas792 жыл бұрын
The app get to this point multiple times, but only when we have a message it show it - I understand now. Thanks!
@DEV_10242 жыл бұрын
you saved my time.. Thanks a lot !!!
@Anas-wp1pi4 жыл бұрын
19:45 i followed exactly your steps but it keeps saying that errorMessage is undefined never mind i fixed it, instead of doing res.render(`authors`, { errorMessage : `something went wrong`}) declare the an object first containing them : let locals = { errorMessage : `something went wrong` } then res.render(`authors`, locals) then in errorMessage.ejs :
@tr4shp4nda_ttv4 жыл бұрын
I noticed I got the error when I mistakenly put !== instead of != in the IF statement
@brighga334 жыл бұрын
Thank you for contributing your solution! I run into the same issue as you did and fixed it using your solution here. My coded differs from yours in that I didn't additionally declare a variable to contain the errorMessage. I think the problem here is that every local variable defined in the res.render actually belongs to res.locals and it should be made explicit by setting it to be when passing to the view.
@amartrem4 жыл бұрын
@@brighga33 Thanks - works for me :)
@brighga334 жыл бұрын
@@amartrem glad I could help! Big shoutout to Kyle for his great content. :)
@AntonyAllocious4 жыл бұрын
@@brighga33 - Thanks Man- You save me
@JoeWong815 жыл бұрын
You have a solid teaching and explanation style bro!!! your channel definitely deserves more views
@WebDevSimplified5 жыл бұрын
Thanks!
@deathvall3y5 жыл бұрын
Hard to find good content like this as youtube search algorithm is messed up and filled up with promotions.
@shrillrock Жыл бұрын
for those getting the MongooseError: Model.prototype.save() no longer accepts a callback error, add a .then() after the .save() and put everything in the then() function like he does for the save() in the video
@nadeemkallungal1884 Жыл бұрын
thank you so much for the help!
@bikebro774711 ай бұрын
I had to remove the "err" and only keep the "newAuthor" callback parameter for it to work. The "err" was being passed the saved object and being read as true in the if statement
@shoeshiner90274 жыл бұрын
I found playback speed = 0.75x is suitable for me. Nice jobs.
@ShivamSingh-kn3gz3 жыл бұрын
Same for me dude,
@IYIrOWN3 жыл бұрын
Oi my whole study group said the same xD
@Sparta1553 жыл бұрын
Great tip.
@agnieszkalewandowska98964 жыл бұрын
Explaining every line **.** Even every single tiny thing you use. You are a teaching god! :D
@Kay8B3 жыл бұрын
At 16:00 you no longer need bodyParser as its built into express now. So it would look like: const express = require('express'); app.use(express.urlencoded({ extended: true })); app.use(express.json());
@BL-ki9qm3 жыл бұрын
THANK YOU: to elaborate the line of code is now "app.use(express.urlencoded({ limit: '10mb', extended: false}))"
@TheGungoBlue3 жыл бұрын
Much thanks to both of you. I was about to spend more time looking for a non-deprecated alternative.
@tewodrosmengistie41334 жыл бұрын
Bruh why does webdev have to be so complicated
@peopleyoumustknow13253 жыл бұрын
I am crying in error
@ahmedboutaraa87714 жыл бұрын
i don't really know why people pay money for coursers to get garbage instead of watching free stuff like this on youtube and i really want to see more helpful content like this you're blessed bro
@BroomieHERE22 күн бұрын
Certificates
@ritaaktay25022 жыл бұрын
Hi, thanks for this awesome tutorial! One question on the locals object: "The res.locals is an object that contains the local variables for the response, scoped to the request so only available for the views rendered during that request/response cycle." hence we get an "errorMessage undefined" error if we include it in layout.ejs and thus on pages where the call to render didn't include an errorMessage option. errorMessage is undefined, but locals.errorMessage is null. So instead of if (locals.errorMessage != null) we can have just inside the errorMessage.ejs and it will work the same way by either print nothing or the error message. Is there something I am overlooking in this option or have I understood correctly?
@ActiveZeni5 жыл бұрын
Great Video! As of Express version 4.16 you don't have to install bodyparser depency since its now bundled with Express.
@WebDevSimplified5 жыл бұрын
Good point. I for some reason only thought express.json() was a part of express and the urlencoded function was left out.
@Aman-Verma Жыл бұрын
@@WebDevSimplified Hi Kyle! Is there any plan for updated full stack course either on youtube or your website?
@vrk40523 жыл бұрын
When I run the app locally it runs as expected, but when I run it on Heroku it seems to give me an error when I try to add an author. I did the IP 0.0.0.0/0 address step. But not sure what is causing the error? @Web Dev Simplified
@valentina7113 жыл бұрын
same problem here. Could you fix it? I can connect to atlas mongo db from my computer in dev mode, and the users were created just fine. But it doesn't work in heroku. UPDATE: it was a typo in the environment variable heroku config😅. Everything works perfect now, thank for this amazing tutorial!
@tesicaleksa67462 жыл бұрын
For those who get an error at 16:49 "name is not defined", u need to include app.use(bodyParser...) before u do app.use(author.router) So, basically instead of: app.use(indexRouter) app.use('/authors',authorRouter) app.use(express.static('public')) app.use(bodyParser.urlencoded({limit:'10mb',extended:true})) , you should do: app.use(bodyParser.urlencoded({limit:'10mb',extended:true})) app.use(indexRouter) app.use('/authors',authorRouter) app.use(express.static('public')
@saurabhdeshmukh95872 жыл бұрын
damn i wasted a few days for this error...thanks a lot man! Here have an imaginary cookie!
@illusion2872 жыл бұрын
ty man
@erfanabac9 ай бұрын
I love you😭😭😭😭❤❤
@beksaylor Жыл бұрын
With the errorMessage ERROR, I just put it like this............Then I no longer got the not define error.
@programmertik20463 жыл бұрын
Hey guys to all those who are facing error message not displlayed plz check if there is a space in your input field ,if it is there then the single space entry is goin in your database .
@Mammoth173 жыл бұрын
For heroku Config Vars don't forget to erase "" when typing in your mongo password. I used "" instead of "password".
@jimmoriya2 жыл бұрын
thank you! I did the same and couldn't managed to find it myself!
@vidhinagda64454 жыл бұрын
How can I add and save multiple fields for Author model? I created the model with all the required fields and I also modified the routes --> authors.js But I am getting an error while creating author. My try block is not getting executed, the error is catched and it says 'Error creating new author'
@sofiyamathew55872 жыл бұрын
did u get the answer? pls help if u found whats error im getting the same erroe
@alessandramiazato4 жыл бұрын
Thank you so much for this course, Im trying to get a job as web dev and your videos are so rich in content it's a great first step before reading that massive documentation I loved those three first videos explaining right to the point concepts that anyone else takes at least 15 min haha
@romimaximus5 жыл бұрын
i never learned so much in one turorial..thank you that was a awesome video...You just got my respect and a great fan...!!
@WebDevSimplified5 жыл бұрын
Thank you so much! I am really glad you enjoyed the video and learned a bunch from it.
@sauravkumarsonu8293 жыл бұрын
Awesome content, It's superb, i found the best thing ever, love you Kyle, but I'm facing an error : When I'm searching for the authors, nothing happens🙄, please guide me
@tea_and_aangilam3 жыл бұрын
Hope you found the issue. I faced a similar problem.. but I had a bug, shown below.. const authors = await Author.find( { searchOptions } ); It has to be.. const authors = await Author.find( searchOptions ); (I tried debugging by displaying the searchOptions and authors fields.)
@oussamaelharmali22944 жыл бұрын
That's the power of JS guy's, I'm a java developer but I just fall in love with javascript such a good and useful lang - thanks for your tuto (y)
@kelvinmugo89773 жыл бұрын
in new.ejs and in _form_fields causing errors.first one says reference error,second says author not defined.whats up?
@xenoaurora3 жыл бұрын
Did you ever find a fix for this?
@kelvinmugo89773 жыл бұрын
@@xenoaurora yes sure thanks
@datatalkshassan3 жыл бұрын
@@kelvinmugo8977 how did you fix this? I'm getting the same error
@devviz2 жыл бұрын
@@kelvinmugo8977 how??
@aviralgupta93644 жыл бұрын
At 16.42 i am getting Create output. as I write command res.send("Create") but as soon as i send res.send(req.body.name) error is coming TypeError: Cannot read property 'name' of undefined I have installed body-parser too and followed your each step till this time. Please help !!!
@ras12804 жыл бұрын
you must be doing something wrong in the authors.js file, when creating a new author. But either way, you can delete that value=
@shahnawazshaikh69604 жыл бұрын
you have to implement the bodyparser to the server before the you define the routes. The order matters!
@zakriajanjua91703 жыл бұрын
it gives me error searchOptions is not defined pointing towards the index.ejs file when i create new author but it still creates the author in the database. What is the problem?
@calebzhou29224 жыл бұрын
I have a bug at 31:23, searchOptions.name is not found in the index.ejs page. Anyone face this, please?
@sauravkumarsonu8293 жыл бұрын
I am facing the same problem
@sauravkumarsonu8293 жыл бұрын
Have you solved this issue, can you let me know please
@rexparker60114 жыл бұрын
at 22:45 on the line that reads: "const newAuthor = await author.save()". I was perplexed that there was no explicit reference to the DB connection created earlier in server.js until I found this webpage: --------------------- Mongoose Schema vs. Model let mongoose = require('mongoose') This reference will be the same as the one that was returned when we connected to the database, which means the schema and model definitions will not need to explicitly connect to the database. --------------------- And that cleared it up nicely. Here's a link to page: www.freecodecamp.org/news/introduction-to-mongoose-for-mongodb-d2a7aa593c57/
@targetproof84 жыл бұрын
I got the same error as you reference below. I tried adding let mongoose = require('mongoose') to server.js file and it wasn't that simple. I got SyntaxError: "Identifier 'mongoose' has already been declared." Any suggestions? [nodemon] starting `node server.js` F:\Apps ode.express.mongodb outes\authors.js:21 const newAuthor = await author.save() ^^^^^ SyntaxError: await is only valid in async function at Module._compile (internal/modules/cjs/loader.js:721:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (F:\Apps ode.express.mongodb\server.js:11:22) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
@EriX-AI-FREE-Team3 жыл бұрын
Thanks for this good content! This is the first time for me to use mongodb, I did encounter a problem, and it's solved. (see below) Hope this comment could help out other viewers in the future. Note: Probably specifically to the users on Windows 10, Not sure. = = = = = = = = = [Problem] = = = = = = = = = At 19:48, after clicking Create Btn, my page just stuck in the same page (without navigating to localhost://3000/authors) = = = = = = = = = [What I did] = = = = = = = = = 1. In routes/authors.js, right below the line with 【if (err) {】, I added 【console.log(err)】 because I wanted to know what happened. 2. On my WIndows cmd, it said "MongoError: command insert requires authentication" I was quite confused at this point because I did follow the video (link below) => How To Install MongoDB In 2 Minutes , and have my mongodb installed. link: kzbin.info/www/bejne/rZTbZJlmmrqcd9k&ab_channel=WebDevSimplified = = = = = = = = = [Cause] = = = = = = = = = 【mongod isn't running】 By just have mongodb installed isn't enough. I should have my "mongod" run as well. So, I follow another video (link below) => How to Install MongoDB on Windows 10 link: kzbin.info/www/bejne/fKiwqIJupb2Zp5I&ab_channel=ProgrammingKnowledge = = = = = = = = = [Problem Solved Steps] = = = = = = = = = Following the 2nd video, here's the outline of that video 1. install mongodb on the host 2. open up cmd and cd to the path including mongod.exe (default path: C:Program Files/MongoDB/Server/4.4(ver. num)/bin/) 3. mongod.exe ====> expected err occur, and the err msg hint us to add folder right under "C:" 4. ADD a folder named "data" 5. Inside C:data/, add a folder named db 6. cd to the path including mongod.exe (see step 2) 7. mongod.exe ====> successfully running At 19:48, after clicking Create Btn, my page finally navigated to localhost://3000/authors Note also: In the future, (if following the default setting), the mogod.exe will be ON automatically when restarting the PC.
@AnnieTaylorChen5 жыл бұрын
Finished this part today. Took me a while to fix my errors, lol. I do have two questions: 1. I noticed we aren't using path.join, which I usually do. If we need to collaborate with people using different OS, it is better to use this, correct? I use Linux but I think on Windows the path is not the same. 2. So far I've used EJS and Handlebars, which one is better? why? I personally prefer handlebars just because I think is more weird than {{}}. But that's not the valid reason...
@WebDevSimplified5 жыл бұрын
1. path.join is definitely better and I should have used that in the places I didn't. I always forget though. 2. It actually really doesn't matter which templating language you use. It is mostly personal preference since they all do the same thing. The only real difference is syntax. I generally use EJS for teaching since it is the closest to HTML so it is the least confusing for people new to templating languages.
@abmilan2 жыл бұрын
To all those people who are not getting an error message displayed, clear the text field there is a chance there will be a space inside it and it will no longer be counted as empty
@utkarshdhiman96804 жыл бұрын
why we used 'locals.errorMessage' what is 'locals'? 23:35
@moss1644 Жыл бұрын
I like you showing the effect of what you are doing side by side in practice. Very clear and easy to understand.
@tangoalpha60133 жыл бұрын
Hello, I have this error at the end of the video when adding a new Author: ReferenceError: Author is not defined at /home/user/myapp/routes/authors.js:24:39 Anyone can help?
@andymcdonald89222 ай бұрын
I know this is 3 years old, but just to help anybody else in the future. Make sure you have the new author route set up correctly as this is where author is defined. If this is done correctly and everything else is ok, it should work //New author Route router.get('/new', (req, res) => { res.render('authors/new', { author: new Author() }) })
@supercoolcat76923 жыл бұрын
The folder and file text sizes are way too small for users watching on mobile devices. Still this is one of the best and easiest to understand Node js courses I’ve ever seen. Thank you very much for this
@rmoshiulhasan0073 жыл бұрын
When Creating a New author, if the author(name) already exists in the database..... For BEST authors(a different page which includes top 10) I may want to show it on Index Page but I don't want to show it on that page (/bestauthors) page, but instead I want to increment the count of book entries from the same author which already exists and I want to show them like this, their name and no. of entries. How can I do that. Please help. Thanks in advance. Best Authors 1. X (14) 2. Y (9) and so on. I really appreciate for your videos.
@rushikeshkumbhar7735 Жыл бұрын
You teach each concept so casually that we start thinking, "ha... it's that easy! we can do it too. " Thank you for the course, it still guides students like me.
@rexparker60114 жыл бұрын
I was getting an error in the author.js route. I tracked down the error and here's what I found: At 30:00 The author writes on line 9: searchOptions = new RegExp(req.query.name, 'i') and this produces an error on line 12 because the .find(searchOptions) is expecting an object and getting a string like this: /jo/i the solution is to create an object on line 9 like this: searchOptions = { name: RegExp(req.query.name, 'i')} Note: I found the error by passing (err) to catch like this: catch (err) { console.log(err) res.redirect('/') } this error should be passed to the page, but res.redirect('/') doesn't seem to allow passing an error message.
@karansukhija4154 жыл бұрын
That's what he exactly did. searchOptions is an object and he added name property to it. He did it right.
@AddisMultimedia4 жыл бұрын
Thank you so so much it works after I made the changes.
@rayhanmahmud65893 жыл бұрын
Thank you.
@tanujagarwal58313 жыл бұрын
at [19:58] when i am submitting empty name field then i am not getting error even though have mentioned the condition required: true in schema but in my batabase empty string is also getting saved. plz help
@peopleyoumustknow13253 жыл бұрын
Did u have solution, I am stuck in this as wel.
@quocdungnguyen6153 жыл бұрын
@@peopleyoumustknow1325 me too
@asemshaat66722 жыл бұрын
I'm still having the same issue. Let me know if you solved it plz
@tanujagarwal58312 жыл бұрын
After few days when i started this again it startee working fine automatically
@rhyno37804 жыл бұрын
Not sure why this is different for me, but for the try catch statement I had to make sure to pass the exception to catch. So line 25 on authors.js I had } catch (e) { hope this helps if someone has an error.
@WebDevSimplified4 жыл бұрын
This is just because you are running an older version of Node.js
@_Greenflag_2 жыл бұрын
GOD I had trouble making this Heroku app working instead of launching it with node in the "start" key, I was launching it with nodemon, it never started, always got Heroku application error xD
@furkanzengin76353 жыл бұрын
Hi, when I am trying to submit new authors, it does not get the information and giving me error that TypeError: Cannot read property 'name' of undefined.
@duonghoanghuy84463 жыл бұрын
Do you fix it up ? if not, you can try: router.post('/',express.urlencoded({limit: '10mb', extended:false}),(req, res)=>{ res.send(req.body.name) })
@Kk-xk5cb3 жыл бұрын
@@duonghoanghuy8446 wow, what a life saver! thanks so much! do you mind how you debugged it?
@parveenrohilla75232 жыл бұрын
@@duonghoanghuy8446 it really helps thanks
@mr.poopybutthole37194 жыл бұрын
This is seriously awesome!🔥 A lot to digest in 30 min... Did saw this video for 5-6 time to get all that info😅
@ivelingachev68112 жыл бұрын
When I clicked create when field is empty I didnt get error message and " " value was inserted in my database.If you have same problem add this to your mongoose schema: const authorSchema = new mongoose.Schema({ name: { type:String, required:true, validate: /\S+/ } }) It solved my problem
@persidachita692 жыл бұрын
Thank you very much
@simpleprogrammer58344 жыл бұрын
thank ya Kyle for this helpful lesson but I'm handling problem initializing the App on heroku it keeps giving me ' Application Error ' when I Enter new author !!! but on my local server every thing is perfectly great and working |: HELP PLZ!
@ricardotenorio56244 жыл бұрын
Have you solved it?
@simpleprogrammer58344 жыл бұрын
@@ricardotenorio5624 no brother unfortunately no one gave me the solution yet 💔
@ricardotenorio56244 жыл бұрын
@@simpleprogrammer5834 this is probably an error when connecting to database, in my situation I paste the databse_url value with "" instead of "test"
@simpleprogrammer58344 жыл бұрын
@@ricardotenorio5624 did it work?
@ricardotenorio56244 жыл бұрын
@@simpleprogrammer5834 yep!
@neo911710 ай бұрын
I really cant understand how this .ejs works and why its good literally every variable I include in ejs files is undifined and idk why what Im doing wrond?
@pinnerKnight11 ай бұрын
I like your explanations but you speak so fast, maybe it's just a feeling I have because I'm not an english native speaker.
@umaedu309711 ай бұрын
could someone help me understand how to make a three different page website according top this model? thank you :)
@omgerplayz5 жыл бұрын
When I try creating a new author on Heroku, it just doesn't respond!
@ricardotenorio56244 жыл бұрын
Have you fixed that?
@sumukhbhat16414 жыл бұрын
Same problem!
@MarkBoyd144 жыл бұрын
make sure that you include your password and dbname (I think dbname can be anything but if not just set it to "test") in the DB_URL on Heroku. Make sure you remove the brackets as well.
@stepanfau64803 жыл бұрын
Faced similar issue - turned out to be a typo in my DATABASE_URL in heroku->settings->config vars. Try doublechecking that :-) if your local dev environment is working, make sure the URLs are identical.
@shashwathsk68802 жыл бұрын
there is some problem in my heroku , even though i white listed my ip to 0.0.0.0/0 my app is not loading it showing 'application error'
@bhaskarnhuchhepradhan85 жыл бұрын
If you get stuck trying to run with with the error "Unexpected token {" then add (error) besides the catch so it will be catch (error) { res.render('authors/new', { author: author, errorMessage: "Error creating Author" })
@WebDevSimplified5 жыл бұрын
Good find. If you run into this issue it most likely means you are running on an older version of Node.js, since the error section of catch is optional in newer versions.
@bhaskarnhuchhepradhan85 жыл бұрын
@@WebDevSimplified Oh that does make sense. Thank you for your response. Appreciate the videos!
@hassanayasrah99082 жыл бұрын
thank you
@Smitty1x2 жыл бұрын
Around the 28:00 mark my terminal stopped responding to npm run devStart and I can't connect to the server anymore
@Mammoth173 жыл бұрын
is anyone else having trouble getting it to Connected to Mongoose "MongooseServerSelectionError: connect ECONNREFUSED ...."
@JenniferStewart1003 жыл бұрын
You may need to look at the last video to see if you missed anything. I know that Mongodb looks different now then when he made this video. When you add the string in Heroku to connect make sure you add the password, but also make sure you delete the portion of the string, and instead add test. It should look like mongodb+srv://user:PASSWORD@cluster0.buw8j.mongodb.net/test?retryWrites=true&w=majority
@stanleylouis10285 жыл бұрын
If you are using prettier with visual studio code, add a .prettierignore file in the root directory with the content *.ejs to keep prettier from formatting ejs (control flow statement) like the if statement in this video.
@WebDevSimplified5 жыл бұрын
Great comment. Prettier is super nice.
@rayhanmahmud65893 жыл бұрын
Even though I love prettier, it was bothering me when it kept messing with the '.ejs' files. Thank you for this solution.
@davidna72644 жыл бұрын
33:00 i put the ip 0.0.0.0/0 there and still Application error on the heroku server. (with localhost its works)
@suthirakprom4 жыл бұрын
if it doesnt work, you just have to wait for a little bit. It might differ on the speed of your internet connection.
@ricardotenorio56244 жыл бұрын
Same to me, on my localhost runs, but in heroku I got connection error =/
@psharma48574 жыл бұрын
@@ricardotenorio5624 Do you have a fix for this now? I am still facing the issue and it says Application error.
@armyindo40854 жыл бұрын
so do i . just have some problem with you
@armyindo40854 жыл бұрын
i fix my problem
@samsammurphy5 жыл бұрын
To use HTML autocomplete (i.e. Emmet) in an ejs file you will need to install the 'ejs Snippets' extension
@WebDevSimplified5 жыл бұрын
Good suggestion. Another thing you can do is go into the settings and tell emmet that .EJS files can use emmet
@samsammurphy5 жыл бұрын
Very cool!
@subratarudra2745 Жыл бұрын
If anyone is facing problem at 20:44, then I would suggest to use "" instead of "" in errorMessage.ejs, this will resolve the error.
@KalpakChakraborty Жыл бұрын
what does the local thing do??
@subratarudra2745 Жыл бұрын
@@KalpakChakraborty I have found this on stackoverflow. I don't know the reason in detail. But I think it will use the local errorMessage(i.e errorMessage of local scope).
@UpTballA4 жыл бұрын
@Web Dev Simplified I tried to watch this course 4 months ago and it was very difficult and I had to learn Laravel at the time so I stopped at this episode. Now coming back to this after learning a lot of laravel. You really don't waste any time and theres so much impact in every action you make. Pathetic this has 16k views, its a goldmine of information. Thanks a lot man for this course
@WebDevSimplified4 жыл бұрын
I'm really glad you are enjoying this course now that you are getting back into it.
@myhanhnguyen51982 жыл бұрын
why do you have 2 routers for creating a new author? I dont understand this part (1:10). as i understand, router.post() for creating a new author while router.get('/new',....) for getting an author
@KalpakChakraborty Жыл бұрын
get at /new is basically to open the page for adding the new author. post at /new finally adds the author
@clintrodricks10625 жыл бұрын
Great video! I'm getting an error at 28:34 stating authors is not defined. I'm pretty sure everything I've done it exactly as you have done it with the exception of running everything locally. Any ideas?
@WebDevSimplified5 жыл бұрын
Check where the error message is coming from and you should be able to trace it back to the issue. If not you can checkout the code linked in the description and compare it to your code
@chaitanyaprakash84705 жыл бұрын
in authors.js remove the ) after authors/index and put it after the closing }
@abdullahihassan82795 жыл бұрын
@@WebDevSimplified i everything is same as your code but it is still not working
@abdullahihassan82795 жыл бұрын
@@chaitanyaprakash8470 that would cause a syntax error
@chaitanyaprakash84705 жыл бұрын
@@abdullahihassan8279 give it a shot it worked for me
@stepanfau64803 жыл бұрын
Tip: Since express 4.16 you don't need to use body-parser. You can go with native express.urlencoded()
@lmartinezj3 жыл бұрын
for some weird reason I get req.body.name as undefined
@thetester83713 жыл бұрын
@@lmartinezj did you fix it in the end? I am getting this error where it says "name" is not defined. I am pretty sure I do not have any typos.
@lmartinezj3 жыл бұрын
@@thetester8371 hi there, I did fix it, but it had to do with a declaration at the top of the program that required a specific logic... It's not at the top of my head right now, but I can get back to you soon
@lmartinezj3 жыл бұрын
@@thetester8371 Got it, went back on my github and found the code commented app.use(express.urlencoded({ extended: true })) // Has to be implented before app.use('/', indexRouter)
@thetester83713 жыл бұрын
@@lmartinezj Ok, thanks man. I will really appreciate it.
@FaTima-lr8yf2 жыл бұрын
I keep getting this error "TypeError: db.on is not a function" or "mongoose.Connection.on is not a function", anyone have an idea how to fix it?
@khalvin82 жыл бұрын
Did you download Mongoose? Check out his video on installing Mongoose. Make sure you assign the PATH correctly. The latest version of Mongoose has a new shell. MongoSH. I had issues getting the service to run as a local service.
@babar-khan4 жыл бұрын
are you gonna make any multi auth registration and login series, please?
@basketberoende4 жыл бұрын
Hello! I'm getting a "TypeError: Cannot read property 'fname' of undefined" when I am trying to create a new (member in my project). I have declared body-parser and required it. I have also double-checked the name of the form and the method. I know the rout is working because when I do res.send('Hello world'), it works, But as soon as I try res.send(req.body.fname), it does not work. If I console log the req.body it says undefined. Do you have any idea where the error might be?
@basketberoende4 жыл бұрын
If any one run in to the sam problem, i found the solution, you have to implement the bodyparser to the server before the you define the routes. The order matters!
@pratikshpatel52274 жыл бұрын
@@basketberoende can you share your code? i have the same issue
@basketberoende4 жыл бұрын
@@pratikshpatel5227 nah bro, i have deleted the project! but all i did was require('body-parser') and the importend part is to do app.use('your body parser') before the routes
@tejasjoshi19074 жыл бұрын
@@basketberoende thanks for this awesome solution !
@jamesmassa19992 жыл бұрын
@@basketberoende Thank you... 😁
@pratikshpatel52274 жыл бұрын
How do you code wise implement the bodyparser to the server before the you define the routes ?
@deathvall3y5 жыл бұрын
authors are being saved to database (local) . I am adding author but none is showing up in '/authors'
@emashno54 жыл бұрын
Im having the same problem on that one too...
@pratikshpatel52274 жыл бұрын
Problem: TypeError Cannot read property 'name' of undefined Solution: -----------------------------authors.js file----------------- //creating a variable to store the body-parser library files var bodyParser = require('body-parser'); // parse urlencoded request bodies into req.body var urlencodedParser = bodyParser.urlencoded({ extended: false }); //Create Author Route [Post is used for creation] router.post('/',urlencodedParser, (req, res) => { res.send(req.body.name) })
@ericalexander38164 жыл бұрын
TypeError: Author is not a constructor at \Fullstack\backend outes\authors.js:13:41 anyway to fix this????
@viperxiv58354 жыл бұрын
did you find a solution?
@ericalexander38164 жыл бұрын
@@viperxiv5835 No, I moved on.
@viperxiv58354 жыл бұрын
word
@viperxiv58354 жыл бұрын
Not sure if you're still interested but I think I figured it out, my node was out of date. Updating it didn't fix it right away but I had to restart my machine and when I came back it was working, so guessing either VS Code or OSX needed to be restarted to get the updated node version working.
@stepanroznik75454 жыл бұрын
@@viperxiv5835 I solved this problem differently. It turned out I made a typo in the models/author.js file. I missed the "s" in "module.exports"
@lenniemoses8003 Жыл бұрын
Anyone else getting "[nodemon] app crashed - waiting for file changes before starting..." in the terminal when running the server? The server actually runs when I start it but then after a few seconds it'll crash with this message.
@houssemkhi50364 жыл бұрын
minut 28,46 ReferenceError: /home/houssem/BUG/views/index.ejs:8 6| 7| >> 8| { %> 9| 10| authors is not defined
@krishnamuraree26622 жыл бұрын
did u found out?
@Marwan-2 жыл бұрын
First of all ThnQ Kyle for this course! If you are having issues with the search not working I found the following to work for me: The Search was just showing me all of the names, and not actually filtering for the search. this is what I did to fix it. Replaced: const authors = await Author.find( { searchOptions } ); To this 'remove curly braces' : const authors = await Author.find( searchOptions ); Most probably the syntax changed from the time this video was made.
@shuklavishwam Жыл бұрын
Hello, Thanks for the video. I tried creating some routes using express but I can't get a way around on ec2. It fails with a Error called Cannot Get /routeName. Is there any workaround to get this done?
9:37 what was the purpose of giving variable { author: new Author() } ,while we creating author on //create author Route, app work fine and creating new auther without above variable.
@ast4530003 жыл бұрын
I'm not sure why he puts the author.name as the value of the input field in _form_fields.ejs. It seems to me the author.name doesn't have a value and it will just be overwritten by anything the user inputs. I do wish he would slow down when he talks too. He seems to talk even faster when he's explaining the most complex parts.
@tag_of_frank2 жыл бұрын
Is there a mongoose model style library for MySql? Up until now I have been writing all my queries and creating tables with raw SQL code the mongoose library is so great.
@jacobthedev49792 жыл бұрын
In "layout.ejs" how does know what to render, yet for the header we have to use "include('...')" in order for it to use the proper header.
@shawonsheikh1632 жыл бұрын
I keep getting the error Could not find the include file "_form_fields" when i try to click on add author and add books anyone know why?
@sounymalivanh8894 жыл бұрын
errorMessage is not defined how can i solve this error?
@WebDevSimplified4 жыл бұрын
I answer this later in the video or in the next video.
@surfinbird714 жыл бұрын
At 22:53
@hassanayasrah99082 жыл бұрын
if the else part in creating new Author not warking even thow you're entering empty value, it might be because the browser add defult white space to the input
@amirabasahmadnia46834 жыл бұрын
Great channel. thank you
@KromedesShooter2 жыл бұрын
I can't figure out how to implement react in a proyect like this? I don't want it to be a SPA. If someone know a tuto for this please link it!
@christopherjenkins24333 жыл бұрын
Keep getting stuck at the authors page. Not sure if it created an author to store into authorSchema, because the ejs file keeps saying authors.forEach is not defined.
@JayRGabz5 жыл бұрын
I'm creating this project right now... so excited to finish this. :)
@WebDevSimplified5 жыл бұрын
I hope you enjoy it!
@haarishkhan2158 Жыл бұрын
how are you able to get author.name and searchOptions.name in ejs file without importing. i am confuse on this can someone explain?
@MonsterFishKeepersPH2 жыл бұрын
the error message just don't seem to pop up when I click the create button without anything as input! please help me!!!!!
@tag_of_frank2 жыл бұрын
With async version how can you get the error out of author.save? Doesn't it make things hard to debug without the actual error?
@omrankhoja3193 жыл бұрын
hey man this is a great series, really solid stuff thank you! One thing that's bugging me is even with the extension my .ejs tags are white rather than gray like the html tags. Anyway I can fix that? Can't seem to find anything online about it.
@WiktorJurek3 жыл бұрын
This is amazing! Have you got a video about the basics of MVC/routing? I feel I need a bit of background regarding the principles behind the decisions you're making.
@o1techacademy2 жыл бұрын
This tutorial has boost my confidence as a full stack developer. Thank you very much Kyle
@fluffydoggo4 жыл бұрын
Wow now my express server REALLY needs updating. The code you are making is wayyy more organized. I have all requests in a single index.js file lol. Thanks for the tutorials though. I'm not new, but it's interesting to learn new stuff. Keep up the good work 👍
@kavithachellasamy23933 жыл бұрын
Thanks for the Video Kyle and ur Effort for making and clearly explaining this.
@h2nrlc Жыл бұрын
This teecher is crazy free
@peopleyoumustknow13253 жыл бұрын
I am stucked in create Author, when I type it just gave me the page All Authors