... in the previous chapters...
How to create a placehold.it image generator clone with Node.js?
What if I tell you generating images is actually an easy task, and you can create a simple placehold.it clone with only a bunch of lines.
Installing dependencies Let's start with the basics. We will start with express and sharp and create a very very simple setup:
Installing dependencies Let's start with the basics. We will start with express and sharp and create a very very simple setup:
import express from 'express'; import sharp from 'sharp'; const port = 8000; const app = express(); Project initialization. Let's start by creating an empty folder and initializing our package.json with npm init. We will also include express to set up our application, express-validator to validate the form submission, and mustache (mustache-express) to render the form.npm init -y npm i --save express express-validator mustache-express The basics. With our packages ready, let's go on and create our index.js. We will...How to create a simple HTTP API with authentication with Node.js?
Build a complete authentication flow in Node.js from scratch — user signup with bcrypt-hashed passwords, login that issues auto-expiring JSON Web Tokens, and middleware that protects routes so only authenticated requests get through.
How to save a web page as PNG or PDF with Nightmare?
Render any web page to PDF or a stitched full-page PNG with Nightmare, Xvfb, and sharp — including the DPI and Chromium screenshot-height workarounds you'll hit along the way. (For new projects, see the simpler Puppeteer version.)