node.js - Node js javascript folder 404 not found -


i'm using express 4.10, nginx, ubuntu 16.04 lts , want create javascript folder in public folder.

public/js/myfile.js 

i see lot of question on stackoverflow 404 on javascript file.

then here html code:

<script src="js/login.js" type="text/javascript"/> 

and in node.js file have :

app.use(express.static(path.join(__dirname, '/public'))); 

here nginx node configuration

upstream node {     server 127.0.0.1:3000;     keepalive 8; }  location ~ ^/(node|socket\.io) {     proxy_pass http://example.com:3000;     proxy_http_version 1.1;     proxy_set_header upgrade $http_upgrade;     proxy_set_header connection 'upgrade';     proxy_set_header host $host;     proxy_cache_bypass $http_upgrade; } 

thanks.

the script source should /node/public/js/myfile.js, or else nginx not pass request express.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -