Communication with relational databases (MySQL) on NodeJs. Best practices - mysql

I am working on REST API, based on NodeJs.
My app get data from Mysql and return to clients. I try to organize my code wich works with Mysql.
Can I use repository + unit of work patterns?
Is "Patterns of Enterprise Application Architecture" of Martin Fowler still actual for NodeJs development? (can I read this book and use all of them, in depends of situations of course?).
Is this project a goot exemple of how I should do? https://github.com/ErickWendel/NodeJSWithTypescript
Or maybe exists another patterns for NodeJs development? Could you recomend good sources of information?

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).

Building a Xamarin Forms App using MySQL

I would like to build a mobile version of a household financial planner web app that I built with MVC, C#, MS SQL, and Entity Framework. What I've learned from my research is that I should communicate with the database for this project using API endpoints. I am familiar with setting up a WebAPI with MS SQL, but not MySQL. Also, the little work that I have done in that field was based on only retrieving information from the database. Not adding application users, roles, or any rows to tables. The web application that I'm trying to base this Xamarin application is at http://abacus.travismcdaniel.me
I have been unable to find a guide our tutorial that teaches what I need to know. In fact, most of the guides I've found are so outdated that I can't follow the steps because the things they say to do simply don't exist anymore.
So my question is this: It's there a n up-to-date guide anywhere that can walk me through the basics of setting up a MySQL database to use with the app that I'm building, then walk me through writing stored procedures, seeing up WebAPI endpoints for those stored procedures, and then incorporating all of that into a Xamarin Forms application?
If there isn't one single guide that does this, are there a few (still up-to-date) that I can work through to get the same information? Thank you in advance.

Github Projects Nodejs Web Api

at the moment I'm trying to get into node.js, especially as a web-api with dedicated functions of getting informations from a database.
I use Sequelize on a MySQL-Database, with Sequelize-auto. The database I am using is the example database Sakila. For the web service I will use Express.
I would like to know, if somebody knows good, well-structured GitHub-Projects, that use the same or at least almost the same technologies I mentioned and that I can use as a reference.
Best regards and thanks, Anton.
Sequelize have an example project
https://github.com/sequelize/express-example

Application architecture MySQL / PHP / Java / AngularJS

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

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...)