how to use custom stylesheets express node

First, create a directory named "public" in your project's root directory to store your stylesheets.

Inside the "public" directory, create a folder named "css" (or any name you prefer) to hold your CSS files.

Place your custom stylesheet file(s) inside the "css" directory. For example, you might have a file named "styles.css".

In your Express application, use the express.static middleware to serve static files, including your stylesheets. This middleware should be placed before your routes are defined.

const express = require('express');
const app = express();

app.use(express.static('public'));

Ensure that the path used in express.static matches the directory name where your static files (including CSS) are stored. In this case, it's "public".

In your HTML files, link your custom stylesheet by using the appropriate relative path from the "public" directory to your CSS file.

For instance, if your HTML file is located in a "views" directory and you want to link the "styles.css" file:

<link rel="stylesheet" href="/css/styles.css">

This code assumes that your HTML file is in the "views" directory and your CSS file is located in the "public/css" directory.

By following these steps, your Express application will serve your custom stylesheets to the client-side when requested, allowing you to apply the defined styles to your HTML content.