Build GUI for a CLI application as a side project [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I rencently developed a Java CLI application, it works fine, but i would like to add a GUI as a side project.
What i have
A standalone Java CLI application
No web framework
No DI
What i want
An electron GUI
The GUI must be standalone and not included in the main project
GUI will have graphs, stats and basic commands like: start stop update and so on
The GUI's state should be in realtime (i means, i would like the GUI to be notified by the Java app if something occurs, instead of spamming the Java app with the GUI)
Since the GUI should be a side project, someway or another, i need to be able to enable/disable the RPC-like (in case someone would like to use CLI only)
My problem
I can't figure out how to communicate between the CLI application and the GUI. I think something like RPC will kind of suit my need, but's i'm not quite familiar to this kind of technologies.
This is basically my question, what would be the most suitable technologie for this project.

There is probably an almost infinite number of ways to do this, but the first thing that I thought of is WebSockets. Presumably you would start your java CLI app first, which could start a WebSocket server. Then start the Electron app, and have it connect to the CLI.
As far as libraries and frameworks, this is explicitly not the place to ask/answer that, and doing so will likely get your question down-voted and closed.

Related

How do I turn my scratch webapp into a Node.js app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 months ago.
Improve this question
I basically have written a webapp from scratch. So I just used a index.html file and a bunch of js and css. Now I want to turn this into a Node.js webapp. How do I get this done in a way that doesn't require much changing of my existing code.
Node.js is designed to allow the server-side execution of JavaScript code. As, if I understand it right, this is a thing that you don't need I am curious why you want to use Node.js. The only thing you want to do is deliver your project files to a client (browser).
Although you could start a HTTP server which delivers the file of your project using JavaScript, this requires much of unnecessary boilerplate code that you don't need to write to get your project live. I would recommend using a regular HTTP server, which is designed to do exactly what you need: deliver files to the client.
Nginx is a lightweight HTTP server, which is easy to configure. Just set the root folder of your project as the HTTP root and nginx will deliver the requested file by itself.
To get started, head over to the Beginners Guide of nginx.
An alternative to nginx would be the Apache HTTP server.

Why do we need express in the frontend? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am quite new to javascript and web application environment. I have seen an express web application project which had a public directory, a client directory, and a server directory. I have a questions
Why do we need an express server file setup in the frontend project
if we already have backend APIs ready and backend server ready
Any suggestion, please
(I have read some article from google, but I need your opinion)
Thanks.
This is a matter of choice.
Backend + frontend
You can use express as your backend server that exposes Rest API's to be consumed by the frontend.
You are then free to choose whatever frontend framework you like. The usual ones are vue, react or angular.
Server side rendering
You can use still use express as the backend and use it to render pages for the frontend (pages defined in the public directory)
Here's my two cents:
If I have the time on a project or if I work with different developers, I would go with separated Backend + Frontend. It is easier to maintain. You don't want frontend guys touching backend code and vice-versa. The separation is clear, we can also freely change the framework we use on the frontend/backend since we have a contract that we follow aka API's.
If the project needs to be done quickly and most of the pages are simple (don't need to maintain too much state, etc.), I would go with option 2.
It's really up to you and your team to decide.

What should I use as backend in electron application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I understand I can design the UI with HTML CSS JavaScript or any other frontend framework.
I even understand that I can connect to any remote API.
what if I want a standalone application with database. How should I connect to the database ? where should I write my application logic?
I feel like there is a missing part in electron do I supposed to use a node JS web Framework like Express?
or I should write all the program logics in pure node JS without using any framework?
What is the best approach to write electron applications if possible please point me any working example.
It is entirely up to you.
While the client/server (frontend/backend) model we've got used to in web applications is a good idea (separation of concerns), it's not the only way to do things when the client and the server are on the same machine.
Electron is built on top of Node.js. So you can use the usual npm modules in order to connect to whatever database system you want to use and do away with frameworks. For example you can write code to fetch data from the database right into your onclick event handler if you desire so.
Having said that, odds are you will find yourself dealing with an unmanageable bunch of spaghetti code if you're not careful. So, some kind of structure is recommended even if you don't want an entire client/server system.
Also, your "client" and your "server" don't have to communicate through HTTP. The interface can be just plain function (and/or method) calls. Electron also has a message passing system (for example: https://electronjs.org/docs/api/ipc-main that you may use.

Javascript client side ssh / ping / scp [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to build a web app that has the capability to scp, ssh, and ping devices on the local network from Javascript client-side. I'm very familiar with Django, but that's all server side code and won't be able to communicate with a device on the local area network.
Is there any way to do this in Javascript? I know that packages like scp2 in NodeJS do exactly what I want, but NodeJS is a server-side framework too. I'm looking for something that does what scp2 does, but client-side.
There is no browser-independent way to do this. You would have to write browser-specific extensions to be able to get access to TCP sockets and the like. Even then if you browserify ssh2 or any of its dependents, you may run into other issues, such as missing node.js functionality not supported by browserify or the browser's extension API.
Alternatively, you could use something like Electron, but that's only if you don't mind the client being a separate application (but still web/JavaScript-based). That would also have the added benefit of having the ssh2 or related code being completely compatible (since Electron uses node.js).

Migration from Java backend with simple Javascript frontend to MEAN stack [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I created a client-server web app using Java backend (JBoss RESTEasy, Jackson, MongoDB) and Javascript frontend (just jQuery and some plugins).
Now as I learning Javascript I want to create the same app using MEAN stack.
What should I start with? All necessary tools are installed (node.js, grunt, bower etc). MongoDB with needed data is ready.
Should I start with Mongoose model for my data? Or with Angular part?
I would suggest building bottom-up from the existing documents in MongoDB to the Mongoose models and doing a quick prototype to replicate a key performance scenario of your existing application. This will help with capacity planning, you'll have real application workloads and a foundation to add Angular on top of later.

Categories

Resources