iamshaunjp / node-crash-course Goto Github PK
View Code? Open in Web Editor NEWCourse files for the Node.js Crash Course tutorial series on The Net Ninja YouTube channel.
Course files for the Node.js Crash Course tutorial series on The Net Ninja YouTube channel.
mongoose.connect(url)
.then(....)
This gives syntax error.
but I tried using callback in mongoose.connect like..
mongoose.connect(url,(err,db)=>{
if (err){console.log(err)}
else {console.log('success')} //this worked
}
Course Material are missing
I have tried to run your code but i keep getting an error saying blog is not defined error and it is showing me the error is in line ejs file of index.ejs line 10. i cant find any solutions for this error
[ ]
[ ]
blog_details controller returns "null" if he couldn't find a blog in the database.
Simple solution:
Add "if (null === result) throw err;" to blogController.js on line 17.
Hello sir, i followed your video: https://www.youtube.com/watch?v=zW_tZR0Ir3Q&ab_channel=TheNetNinja
Really nice one
I would like to get the code, but it seems it doesn't exist, i liked the structure, and i am a lazy developer, i would want your code to be a boilerplate for a project that i am planning.
Thank you..
I had an error when I tried to run npm install -g nodemon
I had a running script disabled error from the terminal and this is how I fixed it:
i can not find the files, have they been removed?
rewrites the middleware with async and await function to be modern
Hi Net Ninja,
I followed your tutorial on youtube (thanks again for the great tutorial ), and I had to adapt the blog_details controller at two points for not running into errors (see (1) and (2) in the code snippet below):
const blog_details = (req, res) => {
//(1) id contains a space as first character, I don't know why, I have to remove it
const id = req.params.id.slice(1)
Blog.findById(id).then(result => {
//(2) if blog is not found result = null, I have to check for that for preventing error at this point,
// otherwise the webpage hangs
// you can trigger this behaviour by using a valid blog id and then change e.g. the last digit
if(result != null)
res.render('./blogs/details', { blog: result, title: 'Blog Details' })
else
res.status(404).render('404', {title: 'Blog not found' })
}).catch( err => {
console.log(err)
// you can trigger this behavior e.g. with /blogs/isajfjklsfnhhsafkhnbsdf
res.status(404).render('404', {title: 'Site not found' })
})
}
I am using:
wsl2 Ubuntu 20.04.2 LTS
node v14.17.2
[email protected]
Nodemon is updating and auto refreshing only the server and those changes are not changed in the browser. so that we have to restart the server everytime. i don't know how your browser is updating the changes automatically.
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.