How can I include css files using node, express, and ejs?

前端 未结 11 851
执念已碎
执念已碎 2020-12-01 01:37

I\'m trying to follow the instructions to https://stackoverflow.com/a/18633827/2063561, but I still can\'t get my styles.css to load.

From app.js

ap         


        
11条回答
  •  甜味超标
    2020-12-01 02:33

    Use this in your server.js file

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

    without the directory ( __dirname ) and then within your project folder create a new file and name it public then put all your static files inside it

提交回复
热议问题