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

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.

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.

Build GUI for a CLI application as a side project [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 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.

Does Javascript and Jquery languages are enough to make a working web messenger application? [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
Can we make a web based messenger application through the use of just these two languages javascript and jquery?
You will at least need to learn some basics of HTML as well.
(Hopefully) you also want to style your application, which means you should learn at least some CSS.
As far as programming languages go you will however need to know JavaScript and can use jQuery (among other things) to manipulate DOM.
Many modern applications however user React or Angular heavily to make the application building process easier in the long run.
You will also need to store your data somewhere, which means either server-side code and learning how to use a database such as mySQL, MongoDB or CouchDB to name a few (noSQL such as MongoDB or CouchDB are probably more appropriate for a messaging app). Or make it easier on yourself and use Firebase or something similar to store and retrieve data as well as handle user account and authentication.
I know all this may seem overwhelming, but making web apps involves a lot of moving parts.
SUMMARY
If you are starting out, I would recommend simpler challenges than a web app, but if that is what you are set on, the easiest in my opinion would be:
HTML + CSS + JQUERY (this is how your app UI is handled)
JAVASCRIPT (connects UI and data)
FIREBASE (stores data and enables user management and authentification)
Resources to help you get started:
https://www.codecademy.com
https://firebase.google.com

Quickest way to implement a basic REST/SOAP server and client for a beginner? [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 9 years ago.
Improve this question
I would really appreciate some help and also I apologize if this is the incorrect type of question for this site.
Basically, as part of my University coursework I have been tasked with creating a REST/SOAP server and client that allows users to store playlist/song information and update it etc.
My problem however is that all the tutorials provided by the university are for Visual Basic, a program and language that I have yet to learn. Additionally the tutorials seem to consist of "open a new project, copy and paste this code, now run it".
I am aware that REST/SOAP can be implemented in a variety of ways and so I would like to find out what the easiest way for me to learn would be.
I am comfortable with javascript/jquery so any solutions involving those would be preferable. I also wouldn't mind using the opportunity to learn Python if it's feasible.
PHP is great, it has a built in SoapClient and is huge in industry as a SOAP/RESTful API language. Anything non-Microsoft will usually use PHP.
As for the client, javascript can very easily work with SOAP objects, as an alternative to SOAP see JSON as a more lightweight communication protocol.
As a starting point, install WAMP if you are on windows, or LAMP on linux and I think MAMP for mac. This sets up a server on your local machine.
Write some php code and run it from your browser to see it spit out raw data. From there you should be able to start learning php basics. http://php.net will have some tutorials.
Regarding the client, check this out it is about jquery processing SOAP responses. Is it possible to parse a SOAP response with a jQuery xml handler?

Categories

Resources