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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -