Application architecture MySQL / PHP / Java / AngularJS - mysql

Intro:
We are redesigning our application architecture and we are about to make import design decisions.
Background and dependencies: All data is stored in distributed MySQL databases. We have two systems that access the databases - one that performs routinely tasks, programmed in Java and our web application - currently Apache2, PHP (Zend1 framework) and JavaScript (jQuery).
The Java app will not be redesigned and the database should remain MySQL.
The web application is supposed to be changed to a REST API and a modern, fast, real-time AngularJS frontend that communicate over JSON.
Since we already programmed all backend functionality in PHP, it would probably make sense to stick with PHP for the REST API - but this is not a must if it makes future development easier, faster and future-proof.
The Java app and the web application share some MySQL queries.
Questions:
Shared MySQL queries: Should we implement them as a) MySQL procedures / views, b) separately in Java and PHP, c) independent service (e.g. another REST API)
Should we stick with Zend1 or rather use a more suited PHP REST framework (such as Slim or Restler or something else)?
Should we stick with Apache2/PHP for the REST API at all (maybe use Node.js instead)?
Thanks!

This post is probably designed to start a flame war... but...
Never rewrite code from scratch. Take what you have, and refactor it to create modern restful services on top of it.
Do it as a slow migration, rewriting one page at a time in a like-for-like manner.
You will have far fewer bugs, it will cost less, and totally avoid second-system syndrome

Related

angular back-end with mysql

Good evening!
I would like to create a web application with Angular 6 but I would like to have Back-end mysql (This is the only basic form I understand a bit) only. Is it possible to have mysql as back-end and without having to use php?
I heard also about mongodb, but can we make requests with conditions for this management system (WHERE, LIKE ... as in sql).
There are two layers in your application - Angular is your front-end presentation layer and an API/Web Service is your back-end data layer which returns JSON data to the front-end. You can use any RDBMS provided your API service supports it. For example, .NET WebAPI supports MySQL through .NET Connector. You can use a variety of API platforms - PHP supports mysql through mysqli and other frameworks.
No, you can not communicate directly between Angular and MySQL. You'll need to build a back-end Web service that calls MySql using php or node. Angular can communicate with this back-end Web service via http.
Here are the steps you need:
1) Learn Angular. Start with the tutorial here: https://angular.io/tutorial
2) Learn how to build a back-end Web service to talk to your mysql backend. You could use php or node.js. See this article for more information. https://www.quora.com/How-do-I-connect-MySQL-to-an-Angular-4-application
3) Learn how to use Angular's http feature to talk to the back-end Web service. (Using the above linked tutorial for help.)
NOTE: You could use firebase instead. It does NOT require that you build a back-end Web service as it provides its own. You can find out more here: https://angularfirebase.com/ or here: https://github.com/angular/angularfire2
If you use Angular in front-end, you can use any backend with it to connect to MySQL database, for example:
Jersey web service written in Java
Php with mysqli
You can also use noSQL database with MongoDB or firebase.
The choice depends on the structure of your database (so you decide if it is better to have relational on noSQL database) and another very important thing is the hosting plan on which you want to deploy your website. If you have a shared server on which you have mySQL and you want to create a relational database, I recommend you to use the following architecture (Angular as front-end, php mysqli as back-end only to select/update from database, and mySQL to store database).

Ruby: Exposing MySQL query ability to users via RESTful API

There are similar posts like this on the internet, but they seem to be targeted towards lower level languages like Java. NetBeans for example seems to have this kind of functionality.
Here is what I want to do:
I have a large dataset of items. I want to create a RESTful API that would enable my users to perform complex queries to retrieve data from the MySQL database on my backend.
The API needs to be able to:
SELECT a table to retrieve values from
Be able to use common MySQL aggregate functions such as COUNT, SUM,
and AVG on the results
Create WHERE conditions
Security is not an issue as this my simply an MVP for now. On a future iteration I will take security into consideration. Are there any Ruby gems which provide a framework for constructing this kind of system?
I am open to using either Sinatra or Rails for this system.
Maybe this can help you:rails-api
Rails::API is a subset of a normal Rails application, created for
applications that don't require all functionality that a complete
Rails application provides. It is a bit more lightweight, and
consequently a bit faster than a normal Rails application. The main
example for its usage is in API applications only, where you usually
don't need the entire Rails middleware stack nor template generation.
or you can use grape gem.

What database for Data Acquisition?

I have to develop a database that will be used for data acquisition, mainly measurements from micrometer which will be compared against a Reference Table inside the db. The platform is OS X. I have been looking at Valentina-DB, SQLite and even MySQL.
My main requirement is: The database will be used by factory workers which may not have a lot of experience in using software. Therefore, the front-end has to be extremely easy to use. This includes installation of the database and the front-end.
What are my options when it comes to custom GUI apps?
Most of databases have no GUI front-end to use "by factory workers for data acquisition" so you need to program it yourself.
One of the approaches would be to use Java Swing GUI and some Java-based database like Apache Derby maybe. You could put everything into runnable jars, talk to database exclusively directly (not network setup, no authentication) and Java is available on OS X form Oracle website. Seems relatively easy to setup and would also run under Windows if at the end desired. This is not the only possible approach but something that is likely to work.
There are many possible alternative approaches.

How to perform CURD on mysql using Node.js

I am new in Node.js. Well i have experience in Backbone on Client side and Server side using PHP Laravel framework.
I want know is following connection/communication workflow is correct or possible:
My application is being designed using Backbone and its stacks and i can use Backbone model/collection to make service calls. But on Server side is it possible to create web service using Node.js (Without using any Server side scripting like PHP).
Am i using Node.js in correct direction at server end.
Here Node.js will perform CURD operations on database and return the result in JSON format.
Please suggest me what we can do here.
Yes, Node.js is fantastic at building scalable CRUD JSON APIs to your backend database.
You can use MySQL, MongoDB, Redis or any other number of databases on the backend. You'll find support in NPMjs.org for all the popular databases.
In addition to enhanced performance of Node.js over PHP, you can also make multiple database calls in parallel with Node.js. That's something PHP can't do. In PHP you must make your database calls sequentially. In Node.js you can make several calls in parallel so long as the calls are not interdependent.

ASP.NET MVC with MySQL as a framework choice for a website

I want to learn ASP.NET MVC, at the same time creating a website project that I have in mind.
The website I'm thinking of would be like displaying a list of pictures based on user's selection, by category, etc. So there will be drill-down on the links. Obviously, the list will come from the database.
Would MVC + MySQL be a good framework for this?
I am a C# programmer with web forms. Just want to learn a new technology.
It's not the gear, it's the programmer. It doesn't really matter which DB or approach you choose, as long as it suits your needs.
Good luck on making the foray into MVC. Once you get over the initial learning curve of understanding routing, controllers, actions and viewmodels you'll see the benefits.
MySQL, and most modern database platforms (relational or otherwise) for that matter, can handle your straightforward requirements of storing simple text data and associated blob objects.
While you're in a learning mode, though, I'd also take the opportunity to learn about interacting with a cloud-based blob data store which are more appropriate for unstructured binary data. My preference is Amazon's S3, but Azure and others exist, to store the binary image data. I would still store the transactional data in the relational database and MySQL would do a fine job there. (Amazon's RDS is MySQL 5.1 in the cloud for this too if scaleability is a requirement...)