Could not find include include file

后端 未结 3 581
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 05:04

I\'m running a simple server

var express = require(\'express\')
var app = express()

app.set(\'view engine\', \'ejs\'); 
app.use(express.static(\'public\'))          


        
相关标签:
3条回答
  • 2020-12-19 05:41

    Try any of these:

    <% include header.ejs %>
    <% include header %>
    <%- include('header.ejs'); -%>
    <%- include('./header.ejs'); -%>
    
    0 讨论(0)
  • 2020-12-19 05:47

    Include paths are relative, you will need to update your paths to include the "partials" subfolder e.g.

    <% include partials/header %>
    <h1>welcome</h1>
    <% include partials/footer %>
    

    See the docs

    0 讨论(0)
  • 2020-12-19 05:55

    Try this :

    <% include header %>
    
        <h1>welcome</h1>
    
    <% include footer%>
    
    0 讨论(0)
提交回复
热议问题