开发者

Node.js including local javascript file located on web server

开发者 https://www.devze.com 2023-03-06 05:33 出处:网络
I have a Node.js server at var/server/server.js And a client at var/www/client.js Is it possible to开发者_JAVA百科 include the client.js from within the server somehow, using the file system addr

I have a Node.js server at

var/server/server.js

And a client at

var/www/client.js

Is it possible to开发者_JAVA百科 include the client.js from within the server somehow, using the file system address so that I can use common functions of the client.js file.


How about var client = require('../www/client.js) ?


you can include any js on the internet. so you shell be able to get yours as well... just add this on your client html site:

<script type="text/JavaScript" src="http://yourserver/server.js"></script> 
<script type="text/JavaScript" src="client.js"></script> 
0

精彩评论

暂无评论...
验证码 换一张
取 消