Using a JS framework for developing a database client application? - javascript

Requirement:Using a JS frameworks and readily available UI elements to develop a database application (which would connect to databases the user wants to connect to using jdbc, and do some drag-and-drop SQL query building etc. and similar functionality)
I understand that I would need some parts of it needs to be residing in a web server. Since not all the users' databases (local, intranet) could be accessible from a central server where I run my application, I am thinking I would need to bundle the server also (apache tomcat) with my application. Is there any simpler tools/methods to architect this, keeping the UI in HTML5/JS?

Since you did not mention any limitations on the technology or framework to be used, see if you can use this.
MEAN -- MongoDB, Express, Angular and Node.
http://mean.io/#!/

Related

Can I create web api using express.js and not have node.js installed?

I am currently in the process of creating a portfolio website for myself but due to hosting restrictions, I cannot make use of Node.js.
I know Angular can run on any web server, but is it possible to make use of Express.js to create web api's with relying on Node.js to run these web api's using Express.js?
If not, is there an alternative solution to create web api's that I can call using Angular and later for my mobile version of my website?
Please note that my shared hosting runs using cPanel.
As per definition Express.js, or simply Express, is a web application framework for Node.js so you can't do that. Alternatives would be to use a different backend language.
That also depends if your server supports them, for example, you can go with .NET CORE
You cannot use Express without NodeJS by definition so you have to deploy your backend somewhere else in you want to use it.
I suggest giving a look Firebase: you could write your backend using http cloud functions in express without paying anything until a reasonable amount of traffic (after that, is pretty cheap). You could also get rid of cPanel and deploy your frontend there via Firebase hosting.
Maybe you can try to build at first a web application with express. Of course you can create a web app without express if you need it. With express and Node.js I created a MySQL REST API. With HTML and Ajax you can fetch the Data from the API. So you can create two applications. One application where you need to run Node.js because it`s much easier to create a REST API with express. The second one is fully without Node.js.
Maybe there are better solutions, but inside each Web Application you can than but you can then access this API in any web application using jQuery. It doesn't matter if it is written with PHP, ASP.Net Core, Java EE / EE4J. You can also access this API in Ruby, Angular, React, Vue etc. using an AJAX request.
In some scenarios you can't start Node.js as a server because an application is already running on apache2 or nginx. There this would be a workaround to use something like this. For example, one could also integrate applications with HTML+JS in a CMS system that accesses other database tables and thus extend such a system without an iframe.
So can be helpful for few scenarios. Now just doesn't get around the actual goal of doing without Node.js completely or even express. But why are there REST APIs? So that you can query the data and incorporate it somewhere else. Otherwise you would have to build a REST API with another technology. Especially in the example of accessing MySQL with JavaScript, this would not be quickly feasible.
If you are looking for a similar solution to separate the web app and the REST API, but you don't need Node.js, then you should really build a REST API with .Net Core or with another technology, depending on what is possible and installed on your server. It could be Java or PHP behind it or Ruby.
The API that provides the REST access does not have to be written in JavaScript. You only need to be able to access it with JavaScript. So you can use many different approaches to access JSON data. I hope that in the short time with my bad English I have explained the basic idea, how to proceed stylistically and where advantages exist in REST interfaces.
With this, it should be self-explanatory that you don't have to use NodeJS and Express, but with JavaScript it's a pleasant solution. Only you have to ask yourself if a JavaScript application has to provide this interface at all or if in the end only a JavaScript application has to access this interface. Very big difference.
For backend rest api you can use golang with gorilla framework. Golang simple keyword and easy to learn.best important point is performance. If your server support golang you can use golang for backend..
ExpressJS is NodeJS framework so it's impossible to create an API without NodeJS.
Angular is front-end framework so you can host it on web hosting server.
If you need to create back-end APIs, you can use other clouding host servers that support NodeJS.
It's fairly simple to build this with just the net/http package. Set up a router that handles various commands and deal with the response accordingly.

How to connect to MS-SQL database via JavaScript?

I understand this is not best practice but I am operating within a limited realm and, as far as I can tell, this is the only solution to this problem.
I am trying to connect to an MS-SQL database both to get data and to put data onto the database. I cannot seem to do it through JavaScript.
ActiveXObject is, from my understanding, now depreciated so that is not working, which eliminates every functional solution that I could find recommended in the past.
Please note: I am not a web developer and I have no access to any of the standard web development tools for this task.
This is the question has been asked multiple times in various forums - Can my client-side Javascript (running in a browser) connect to a database server and fetch data?
The short answer is - not recommended in general, not feasible without breaching security and without using outdated technologies. Let us dig into it.
It is possible to connect to remote database from a browser using outdated technologies
There are two pieces of technologies from Java and .Net worlds - Applet and ActiveX that run on the browser and can communicate to a remote database. The Java Applet is hardly used by anyone nowadays and browsers are stopping to support it. ActiveX is discontinued by Microsoft in their newer browser Edge. So, you have to enforce your target users to use old insecure browsers if you want to go with these options.
Do not use this.
Use databases embedded in the browser and sync with a remote database
You may use the database locally available in the browser and perform all read/write operations. Periodically sync this database with a remote one. Here are the options:
MongoDB and use change stream to sync with a remote MongoDB
PouchDB and sync with a remote CouchDB or even a MySQL database
Use this only for offline storage temporarily in the browser.
The traditional and secure approach to connect to a remote Database
Use a server-side technology to develop an app that your client-side code (Javascript, HTML) talks to. The app may provide RESTful APIs to interact from the client-side. Then the app that is running in a web server connects and interacts with the database. There are plenty of server-side technologies such as Java, PHP, Python, NodeJS (Javascript based), .Net, etc. to develop your server-side app.
Go with this option.
Well javascript is a client side scripting where as your database runs on a server. So firstly you cannot connect to a database for executing any query from client side i.e javascript and also you need to setup a server side service which can connect to the database and execute the query and give you the result at the client side. You can refer any client-server architecture for this on the web.

Sails.JS or Loopback for Electron App

I am developing a image capture/storage software for school photographers that uses an angular front-end using electron to make it a native cross-platform desktop app. The app will need to have online and offline access. I will run a database on the client machine while offline and when online access is obtained it will sync to a cloud based database. In the future I want to be able to have the option for enterprise customers to run the application on premise and link to their own databases as well.
I was looking into using either Sails.js or Loopback to do this. Do you think one of the frameworks would be better for my particular use case? I would assume that both frameworks would be able to sync the offline data from multiple clients to the master cloud database using transactions easily? Any input you have would be appreciated! Thanks
(Also would react and redux be a better option for the font-end with electron opposed to using angular?)
Deciding which one suits you best is your call, but technically speaking Loopback can do what you need.
The offline/online sync is referred as isomorphic Loopback. Basically, you can run loopback client-side in offline mode, and when you get a connection it will sync with the remote server (that, ultimately, decides if the local data is accepted or not, depending on access control, validation, etc). There is an example repository. Be aware that this functionnality is still considered experimental.
Transactions are supported by some database connectors but not all of them. You can find the documentation here.

Server side for dojo-based+Qt5 application

I'm studing dojo to create web applications.
The HTTP server will be a Windows machine with IIS.
On the same machine will run my own Qt5 application to provide all backend logic for the web pages. I'm going to use dojo for them.
I wonder what is the best way to exchange data (JSON) between the client (dojo) and my application (Qt5).
In the docs I've learned how to use the AJAX methods to make HTTP requests (https://dojotoolkit.org/documentation/tutorials/1.10/ajax/index.html). But they rely on the HTTP server, instead I need to communicate with my Qt5 application.
What do you recommend?
Of course I'm trying to avoid (web)sockets!
The Dojo main modules for loading data in your application are based on AJAX, examples require, dojo.xhrGet, the content is actually in JSON format. Dojo has also support for restful service with module as dojo/store/JsonRest.
Dojo also offer you some support for socket using dojox
It really depends of the scope of your Qt5 application if you need bidirectional communication web sockets could be a reasonable solution.

Connecting to a MySQL database using AngularJS

I'm trying to create a mobile application using AngularJS and Ionic Framework. However, I'm lost when trying to find a solution for backend database support. Is there a plugin or third-party API available to use to accomplish this?
Client side web applications do not connect directly to SQL database servers.
You need to pick a server side programming language and write a web service interface to your database.
Then access that interface using XMLHttpRequest (which Angular wraps with $http).

Categories

Resources