javascript - I can't use my static JS files in ExpressJS -
i'm new nodejs. i'm calling static javascript file within ejs file. not outputting onto console.
my .ejs file:
<head> <title><%= title %></title> <link rel='stylesheet' href='/stylesheets/style.css' /> <script type="text/javascript" src="/javascripts/calc.js"></script> </head> <body>...</body>
my static js (calc.js) file:
console.log("why not working?!");//this have no more code here
i have added app.use(express.static(path.join(__dirname, 'public'))); in app.js.
my static js file in public --> javascripts --> calc.js
thanks.
in app.use() joining __dirname , folder "public", yet in ejs file src script @ root, not under "public." might issue.
Comments
Post a Comment