hello world

hello World !!

Super Admin 26 Feb 2026 1 min read 40 views 0 likes
hello World !!
hasdlf oiwrhgo dpg vw pgu nve9wrug zdlknw9gu zdlvwgu jrg9usd.vkw9ga
🟒 Step 3 β€” Delete User routes/web.js router.delete("/users/:id", loggerMiddleware, deleteUser); controller: exports.deleteUser = async (req, res) => { try { const user = await User.findByIdAndDelete(req.params.id); if (!user) { return res.status(404).json({ message: "User not found" }); } res.json({ message: "User deleted successfully" }); } catch (error) { res.status(500).json({ message: error.message }); } }; 🧠 Laravel vs Node (Now Clear) Laravel Node User::findOrFail() findById + manual 404 User::update() findByIdAndUpdate User::delete() findByIdAndDelete $request->id req.params.id return 404 res.status(404) 🟒 Step 4 β€” Install Nodemon (Auto Reload) Instead of: node server.js Install: npm install --save-dev nodemon Add in package.json: "scripts": { "dev": "nodemon server.js" } Now run: npm run dev Server auto reloads when file changes. Laravel equivalent: php artisan serve (auto reload built-in) 🟒 Step 5 β€” Use Environment Variables (.env) Install: npm install dotenv Create .env: PORT=3000 MONGO_URI=mongodb://localhost:27017/nodecourse Update server.js: require('dotenv').config(); mongoose.connect(process.env.MONGO_URI) Use: app.listen(process.env.PORT) Laravel equivalent: .env file config() 🎯 After This You Are Backend Ready For: βœ” JWT Authentication βœ” Role based access βœ” Admin routes βœ” File uploads βœ” Production deployment

Share:
Comments (2)
J
John Doe 23 hours ago
Write your thoughts here........
H
hello boss 1 day ago
Hello world !!!

Leave a Comment

Your email will not be published. Comments are moderated before appearing.