I've got to partial folders-header.ejs and footer.ejs-I've got the css working on those files. But when it comes to the main ejs file(I guess you could call it the body file). II cant get it o work
app.js
const express = require('express'); /**Creates a constant(meaning it cannot be changed) called "express" and make it require the express module*/
const app = express() /**Creates a constant(meaning it cannot be changed) called "app" and make itequal to the nicknamed constant as a method*/
const port = 3000/**Creates a constant(meaning it cannot be changed) called "port" and equal it to a value of 3000*/
const expressLayout = require("express-ejs-layouts");
//STATIC FILES
app.use(express.static("src/public")) /**Uses the .use() method of the nicknamed constant "app" and passes the .static() method of the nicknamed
constant "express" telling the the location(src/public)*/
app.use("/css/Partials", express.static(__dirname + "src/public/css/Partials"))/**Uses the .use() method of the nicknamed constant "app" with the parameters of
"/css"(part of the location) and the .static() method of the nicknamed constant "express" with its own parameter of __dirname plus
the whole location(src/public/css)*/
app.use("/img", express.static(__dirname + "src/public/img"))/**Uses the .use() method of the nicknamed constant "app" with the parameters of
"/img"(part of the location) and the .static() method of the nicknamed constant "express" with its own parameter of __dirname plus
the whole location(src/public/img)*/
app.use("/js", express.static(__dirname + "src/public/js"))/**Uses the .use() method of the nicknamed constant "app" with the parameters of
"/js"(part of the location) and the .static() method of the nicknamed constant "express" with its own parameter of __dirname plus
the whole location(src/public/js)*/
//SET TEMPLATING
app.use(expressLayout)
app.set("layout", "./Homepage")
//SET VIEWS
app.set("views", "./src/views/")
app.set("view engine", "ejs")
app.get("", (req, res) => {
res.render("Homepage")
})
app.listen(port, () => console.log("Listening on port: " + port))/**Use the .listen() method in the nicknamed constant "app" to lsten to the
nicknamed constant port with localhost(i.e https://localhost:3000) and logs some text in the console*/
and my body ejs file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Perry Landscape Co.</title>
<link rel="stylesheet" type="text/css" href="public/css/homepage.css">
</head>
<body>
<%- include ("./Partials/header") %>
<h1>Sup</h1>
<%- include ("./Partials/footer") %>
The <%- %> do work and point to the right page.