ejs 3

Section 27: An Introduction to Node.js - A Different JavaScript Environment

The goals 💪🏻What Exactly Is Node.js ✌🏻Writing Node.js Code 👍🏻Using Express.js 👊🏻Talking to a Database How to use File System const fs = require('fs'); fs.readFile('user-data.txt', (err, data) => { if (err) { console.log(err); return; } console.log(data.toString()); }); fs.writeFile('user-data.txt', 'username=Max', err => { if (err) { console.log(err); } else { console.log('Wrote to file!'); } })..

Section 32: Milestone Project: A Complete Online Shop - Applying Everything We Learned

The goals 💪🏻Plan The Project ✌🏻Frontend: HTML, CSS & Browser-side JavaScript 👍🏻Backend: NodeJS & MongoDB - Customer & Admin So let's try to build our project step by step! Installing the packages Since we will use node, we initiate node program manager, and put '-y' which means we will say 'yes' for all the questions. And of course we need express! To make our server reopen itself every time whe..

Section 19: NodeJS & HTML Files - Working with Templates : Working With Static & Dynamic Files

The goals 💪🏻Sending HTML Files as Responses ✌🏻Serving Static Files 👍🏻Working With Dynamic Templates A project we are gonna build through this section res.send vs res.sendFile You can't use both res.send() and res.sendFile() in the same route and method because every request has only one response and each one is called first, that's your response. You're trying to pass a filename to render, but i..