본문 바로가기

프로그래밍/Web_language

[Nodejs] 이미지, CSS 경로 안잡힐때

반응형

First, you set the public (folder) as static in the server.js

server.js

// configure our application
const Express = require('express');
const app = new Express();
.......
.......
app.use(Express.static(__dirname+'/public'));
.......

then your html file

<img class="logo" src="/images/Heading.png" alt="My_Logo">

your images path location-

project(root folder) \ public \ images\ Heading.png

반응형