Wednesday, 3 May 2017

Generate an absolute url for my javascript file so it can be loaded by anyone

I have set up a server (node/express/mongodb) and in that server I have a javascript file (called e.g myscript.js).

So, I want to be able, to include this javascript file into any other website I host (like to include it in my head index.html into my other websites: <script src="path-to-my-server:8080/myscript.js"></script> )

In the same way I can load this javascript file for example:

<script src="tutorialspoint.com/example.js"></script>

My server structure is like this: (if it's helpful)

-my_server
---node_modules
---server
------routes (api routes etc)
------models (models like users etc)
---config.js
---package.json
---server.js
---**myscript.js**

The main entry point for my server is server.js

Thanks in advance.



via Tasos

No comments:

Post a Comment