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.
Related
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).
I started new project for Retail Shop, I need to connect Angular 2/5 with MySQL Database using Node or any other method. I need Examples for Select, Create, Delete, Update. for now i need to create Login Page.
The only way you can do that is through http requests to the nodeJs server, since Angular runs in the web browser, while node runs on a server (javascript execution environment).
To create an Http service in Angular you can follow this link. In this way the nodejs server will be able to receive the data and be able to process them through a connection to mysql.
Well connecting Angular???
First learn that Angular, front end, does never connect to any database directly (not counting a New England db or LocalStorage as Database).
You need node or any other server side technology and then serve a REST API for providing data to your front end applications. SO actually your front end app in Angular is a complete separate application and your server side application will only connect to DB, handle logic and serve a REST API.
I use Sequelize for easy connecting and writing queries in JSON syntax.
Some more resources:
https://www.sitepoint.com/user-authentication-mean-stack/
https://medium.com/of-all-things-tech-progress/starting-with-authentication-a-tutorial-with-node-js-and-mongodb-25d524ca0359
Full Example app: http://jasonwatmore.com/post/2017/02/22/mean-with-angular-2-user-registration-and-login-example-tutorial
Angular is for your front end.
If you want Angular like syntax / Typescript for the back-end / server, have a look at: nest.
Nest (NestJS) is a framework for building scalable Node.js server-side applications.
I want to use NativeScript to build my apps. But I'm a bit confused by what backend approach I should use.
I want to create a simple CRUD app, that writes to a DB like MySQL or postgresql. Should I a build a backend api service to carry out my CRUD operations using something like express/node stack? or should the app itself perform the CRUD operations using NativeScript?
I would like to make the NativeScript app itself perform the CRUD operations it self as I feel creating a backend service for a simple CRUD app might be overkill. But I'm not sure if NativeScript is able to perform CRUD services to a DB like MySQL for user auths etc.
Well, on most mobile phones they already have built in SQLITE database engine. Since your using NativeScript; you should checkout my NativeScript-Sqlite plugin as it contains the ability to do CRUD create/read/update/delete to/from a sqlite database on both iOS and Android platforms. If you aren't familure with Sqlite, Sqlite is used in a huge number of applications on the phone and on desktop apps like FireFox.
If you really want to use MySQL, then you will have to always have a wifi/internet connection and build some sort of a bridge via the built in HTTP module; or using something like my NativeScript-WebSockets library to talk to your back end mysql server.
However, even if you are wanting to update a MySQL database on the internet; I would recommend local database storage be in sqlite; then you sync the data when you need too.
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
Recently started to learn Flex technology to create RIAs. And now I want to create web based application of my created program in C++ builder. (flight info sys)
I liked the Flex because of it's cross platform and animation rich possibilities. One of the best web applications that i faced with in the inet is http://examples.adobe.com/flex3/devnet/networkmonitor/main.html
it has wonderful animating grid possibilities. Its server technology is in Java.
How about converting this data service to PHP? That should read data from mysql in PHP..
I prefer working with PHP (as data service) and MySql (as rdbms) in Flex...
seeing animated grid is so cool :)) Switch to Grid mode!
Is it possible to convert it's Data service to php?
Flex is a client side technology that is server-side agnostic. There are a number of ways you can use PHP to get what you want. The preferred approach for maintenance and performance would be using AMFPHP which allows you to define a PHP based destination that behaves like Blaze DS with respect to AMF.
Is there any reason why you would want to combine to system that do exactly the same thing? blazeds uses AMF and flex data service will ask you to download Zend which contain amf for php if you are using php server.
If you are using php as the flex server, connecting to mysql server is very easy, you would probably need blazeds if you are using other database server such as mssql server and so on.
php server is the best way to go in flex using flash builder 4 and above with mysql server.