Publish a javascript file on a C# publication - javascript

Just a quick question, so I might continue with my work or change it.
I want to implement a javascript file into the publication of a C# webapp its .NET and the publish is through visual studio.
"node api.js" would be the command
This js is an api, its just listening to a port for when a request come in. This js code, has nothing to do with the rest of the project.
I just want that when we publish the webapp the little js file executes in the back listening.
Is this possible?

Related

Is there a way to implement IPC to a HTML5 web browser (served using LAMP server)?

Forgive me if this is a silly question but I could really use advice on the direction to look at for a project I am working on.
I made a webserver that streams RTSP to a webpage using LAMP, php and mysql; and served a html template. This was done on a raspberry pi and it all works fine as is. Also done on an Ubuntu VM.
EXAMPLE I FOLLOWED: https://www.thewebblinders.in/programming/article/rtsp-streaming-on-a-web-browser-6069
The next part of my project was to add buttons to the html page, that when pressed send a universal protocol command. I found that I needed to do this using IPC (inter-process communication) however I'm not really sure how to implement this to what I have now.
At the moment my system works simply as a html webpage that is served from /var/www/html using npx http-server --cors (from the open source server environment NODE.js)
I'm not really sure how I could implement a python or javascript back end that communicates to something like electron.js (I tried the latter method but had no success).
Would it be a separate program that acts as a server that hosts the html page instead of Node.js? Would I still keep my templates and methods in the LAMP src directory (/var/www/html)?
Any advice on the possible direction I could look at would be a lot of help. I've not found much online that discusses IPC work on html templates served by node.js. The only html related topic I've seen relating to it is JavaScript with electron.js and that changes the way my webserver is ran.
Thanks for taking the time.

How can I setup an online server to constantly be executing my javascript code?

I have created a JavaScript program that I want to have running 24/7 on an online server. How do I setup a server to make that happen? I am using infinityfree.com as my host for now. At the moment I have setup an HTML file that loads my javascript when a user connect to the webpage, but that is not the behavior that I want.
Ideally I would like to be able to use this infinityfree server to host a very simple website, and have it also constantly running my Javascript code, whever a user is accessing the site or not. Any advice would be greatly appreciated.
I will be online to answer all questions or comments instantly for the next 30 minutes.
Use NodeJs : https://nodejs.org/
You can easly run js scripts with it.
My advice is to use docker to run and deploy a node server in just 2 minutes of time. After adapt you're script to never end. At the end, you Just need to find a cloudhoster.

how am I going to test my node.js code in the browser?

newbie here.
So I have this button, when a user click on that button, a node.js fs function will execute and will create a new folder for me, that is the fs.mkdir() function,
the code is just simple, and works on the terminal too, but I do not want to work in the terminal anymore I want to test on browser, I want to bind html elements to nodejs, I am so confused right now, when I open my html file it gives me an error : "require is not define", I search and search for hours. and I realize that most of the tutorials online they test and run the code in the terminal so how does someone test on browser to know if their code works?
to summarize my problem, I just want to interact on html elements, and that elements will cause to fire a node.js functions, how do I test it in the browser?
Node.js is used to run javascript on a node server. It runs server-side
The browser plays the role of a client
If you want to click a button in the browser and then execute a function in nodejs as a result of the click, you need to know that the architecture is a client-server
You'll need to setup a nodejs server, maybe using express.js, and then you'll need to do maybe a form in html that sends an http query from the browser to the server, so that the server executes the script you want.

how can run and edit locally this Angular website with VS

I am new in Angular things and need to run and edit a angular website. The files I got from the web server (windows Server 2012).
This is the web server directory
Then tried to remote edit the website with Webmatrix, but this did not work because there is no proper debugging.
Now want to run and edit the website locally.
The database i could setup locally. She is the base for the (asp.net mvc) webservice the website runs with.
For edit and debugging the webservice and website structure i want use Visual Studio, but i dont know how to bring in all the files and make them run.
I would use the new VS Code editor. as this is all client side.
https://www.visualstudio.com/en-us/products/code-vs.aspx
and if you create a website in IIS, and copy the code into the WWWROOT directory you will be good to go.

IRC webclient on normal webserver

I want to set up a website which can do this:
The page itself should be blank or just a connect button.
While on the website I want to connect to an IRC server and listen for a specific command, which is given by a simple IRC message.
When receiving this command I want to play a short sound file that the command arrived.
This have to run in the webbrowser and should work on a normal webserver.
I already found something about node.js but this sounds like everything runs on the server itself, but this is what I don't want to have.
How can I do this? I know that I need javascript but I don't now where I could start.
I'd prefer some light open source projects I can modify a bit so there isn't much to do for me.

Categories