I am attempting to link a css stylesheet to my basic html webpage. I am utilizing parse.com hosting for dynamic webpages that utilize express.
There are numerous responses to this question, but none of them have proven successful in my case.
I am trying to incorporate my css file from my .ejs page using the following code:
<link rel="stylesheet" type="text/css" href="css/content.css" />
I placed my css folder within the public directory.
The most commonly recommended solution is to include this line of code:
app.use(express.static(__dirname + '/public'));
however, this method did not produce the desired outcome.
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/public'));
// Global app configuration section
app.set('views', 'cloud/views'); // Specify the folder to find templates
app.set('view engine', 'ejs'); // Set the template engine
app.use(express.bodyParser()); // Middleware for reading request body
// This is an example of hooking up a request handler with a specific request
// path and HTTP verb using the Express routing API.
app.get('/content/:id', function(req, res) {
res.render('content', {message: "hi"});
});
I am following the guide provided by Parse to configure express:
Upon attempting to deploy my code, I encounter the error message "Update failed with Could not load triggers. The error was ReferenceError: __dirname is not defined"
Where could I be going wrong in this process?