What is the actual advantage of running an AngularJS web app over Node.js instead of a server like Xampp? - angularjs

As stated in the title,
I don't really understand how Node.js works and above all why it's actually used to run an AngularJS application (e.g. in WebStorm IDE this is the default option when you create an AngJS project).
I've got this doubt since I could run a simple AngularJS app on an Apache web server (within Xampp) without any involvement of NodeJS.
Thank you in advance

Node.js is an application platform. It's good for running your applications on.
Apache HTTPD is a web server. It's good at serving web pages.
They're two very different things, not directly related, and not mutually exclusive.

You are correct that many apps can run anywhere, but some benefits we've seen are:
Simplicity, especially for web developer also developing the server-side code/config/deploy.
Real-time web - easier to add in things like WebSockets and Server Sent Events if you need them.

Related

Should I develop a separate express server, or handle all API calls in my next.js app?

My website will perform CRUD operations and will work with MongoDB and Firebase storage+auth.
What are the reasons / advantages to developing a separate Express server instead of integrating everything in my next.js app?
As far as I have seen, it can all be done in my next.js app, but I still see many projects working with a separate server.
Depends on what your app does and how you are hosting it.
Running Next.Js on a standard server will be of little difference whether you are using nextjs's /api or expressjs.
However if you are hosting on serverless (e.g. Vercel), I would recommend using a separate express server if you have alot of CRUD operations because the warming up of serverless is really bad user experience.
Build and Deployment
Next/JS - If you want to edit something on the backend, and push the changes, it will require you to build the entire JS app, and depending on how big is your app, it can take alot of time (especially if alot of static generated pages).
Express - If you running express separately, you can build and deploy front end and backend separately. It's time saving, and you can also better organise your codes frontend/backend.
Choice of deployment
I have a choice to take advantage of Vercel to host my frontend, with static generated pages and some server side generated pages (automatic scaling, caching, CDN etc), and host my backend with a separate cluster of servers.
PS: I moved from single Next.JS app to NextJs+Express
I can think of a few things why they would have a different server from the one NextJS provides:
Familiarity with Express, Koa, etc. All next-connect helps with this
There is an already existing API in PHP, Express, Flask, etc.
It is literally based on what you would want to do, the extra interactions with MongoDB & Firebase would be same on both the technologies, unless you want to isolate respective things separately, I don't see any harm in doing everything together on next.
Given that the idea of using next.js, as per my understanding would be to utilise server side rendering.
I've been using Next.js with Typescript for quite a while now and I, as of now, have found one reason not to include express.js in my project. And the reason is Vercel.
Since I use Vercel for continuous deployment of my projects, and Vercel Not supporting any custom server as of there Docs here, I refrain from using Express or any other custom servers.
I didn't face any problem performing CRUD operations with MongoDB, can't say about firebase.
On Next.js Docs, I found these points to be considered:
A custom server can not be deployed on Vercel, the platform Next.js was made for.
A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.
But at the end of the day it very personal opinion weather to use a custom server or not. It might depend on a very specific use case you might be looking for.
Personally, I try to keep it to just NextJS, but if I have to manage real-time data with Socket.io, I get a separate server because other than WebSockets, serverless functions can do everything else.

How to deploy RESTful api created with node js

I have few questions that I don't understand or need a few tips.
Two weeks ago i started with angularJS and created few app's, than I started with RESTful api's and than went to node JS to make one RESTful api.But now i am bit confused...I have made node js api that connects to mySQL and can handle PUT, GET, DELETE and POST and when i use Postman, it works smooth. Now i want to set my node js RESTful api on some hosting so it can be available 24/7 and i am not sure how to do it... do i need tome kind of cloud service or normal web hosting can serve it? As i see, it must run server side and not sure how to implement it :/.
There are several options:
you could use "standard" web hosting, as long as you have ssh access to the box, and not just FTP. This usually means a dedicated server, a VM (often known as a VPS), or some times of shared servers, but that's rarely the case. Basically, if it's free or very very cheap, it probably won't do.
or you could use hosting services that are specifically tailored for node.js apps (and a few others), such as Red Hat's OpenShift, Heroku, and others.

What technology to deploy RESTful Server with SQL+COM capability

We're developing a cloud based web application for customer management. One of the main goals i the capability to connect to different local applications on the customer endpoint.
As example, we don't want to have a customer database in out application, the customer should be able to search within his local ERP system right away.
What we need is not much. Only a client on the customers server with access to the local SQL server as well as the COM model.
But as webdevelopers and mainly going with PHP the question came up, what technology we should use?
I've got two approaches in mind:
NodeJS
Lightweight, Javascript and with the Express and winole32 extension we should have everything we need. But the deployment and installation as a service seems to be a bit wacky.
C# .Net Web API
Also a good approach I guess since the client servers are allways windows. But is there a way without IIS?
Or do you have something completely different in mind? It should be very fast and compact. So its basically just a RESTservice that can be deployed with ease.
Thanks for your inputs and thoughts.
C# .Net Web API Also a good approach I guess since the client servers are
allways windows. But is there a way without IIS
It is called OWIN and it is properly documented (web api self host is a good keyword) and works like a charm. Using that on various services to expose an API into the service.

How can I turn an Eclipse GWT/GAE app into an Eclipse Tomcat/mySQL app?

Sorry in advance for the long post but the problem I am facing here is quite crucial for me, so here we go...
I have a Eclipse GWT (2.0) Web Application using the the GAE and making transactions with its datastore.
On the other hand I would like to make sure that I can also deploy this web application on another infrastructure than the Google App Engine. Therefore I wanted to debug my web app using another servlet container (Tomcat 6) and another datastore (mySQL or MSSQL or any other, it doesn't really matter for now.)
In order to be able to debug an Eclipse web app with Tomcat it has to carry the Dynamic Web Project facet. If it doesn't then the new server that I add to Eclipse within Servers refuses to pick my GWT module in its list of supported apps. And not only GWT Web Apps don't carry it, but they don't even allow to alter the project's facets at all!
However, I found that adding the few relevant tags to the .project file can make it eligible within Eclipse to allow new project facets additions. Here are the tags I used:
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.appengine.eclipse.core.gaeNature</nature>
So I did that, I could "turn" the project into an Eclipse's Dynamic Web Project and by doing so made it compliant to be added to the list of modules handled by - let's say - Tomcat 6 within Servers.
So that is exactly what I wanted, I can now switch between two debug configurations at will in Eclipse in order to debug my GWT web app either on the App Engine or on Tomcat.
The problem is that adding the Dynamic Web Project facet disturbs the DataNucleus enhancer. For some reason, once the project has become a Dynamic Web Project, it seems that the enhancer is never called anymore and I get this error message saying that some classes haven't been enhanced. Playing with the Google... App Engine... ORM classes or checking/unchecking the Enhancer in Builders wouldn't change anything. Please note that the enhancer issue affects both debug configurations: Tomcat as well as the App Engine.
So I was thinking of two solutions.
(1) Disable the Google plugin's DataNucleus enhancer and perform the enhancements myself. So I installed the DataNucleus plugin to configure project specific enhancements by following their guide about the Eclipse plugin.
They say that by right-clicking on the project one can activate DataNucleus support for the given project's files. Unfortunately, after installing the latest version of their plugin for Eclipse, no such right-click menu appears! I have therefore no way to tell their plugin that I want to activate the enhancements on a given project! How frustrating is that?? (I uninstalled/reinstalled the plugin, let perform plenty of pending Eclipse updates... but still no right-click menu.)
Does anyone know of another way to activate DataNucleus enhancement? For now I would be happy even with a pretty manual trick as it is very critical for me to be able to perform this cross-servlet container debugging within Eclipse.
(2) Use this tip from the official GWT website http://code.google.com/webtoolkit/doc/latest/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT%27s
Ok that works, and for now let's say that it saves my life BUT... it requires hosted mode and therefore doesn't allow the use of GWT 2.0.
So regarding this workaround I would like to know if there is a way to do something similar under GWT 2.0?
Turning the GWT Web App into a Eclipse Dynamic Web Project would be the ideal solution for pursuing the development of my application. As I said above, that way, it is very convenient to switch from the App Engine to Tomcat and vice versa. So I favour workaround (1) over workaround (2). But anyway, some help or piece of advice regarding any of the two points will be very very welcome.
Thank you for reading this very long post!
I always use Google Plugin (GPE) for GWT development even when I deploy to Tomcat, where I simply disable GAE option.
Perhaps, I don't understand the question - but I have had no problems debugging my app running on jetty and then transferring the app to Tomcat. Are there any issues that I need to learn?
In fact, even when my app is plain jsp or servlets, without any GWT, I still used GPE. But GPE would refuse to run jetty without either GWT or GAE enabled. So I simply create a dummy GWT app. In all my years, I had never had to worry about differences between jetty and tomcat. And if I had to write an app where I had to exploit the differences in tomcat over jetty, I would consider myself a lousy programmer.
The only reason I see to push JEE server into an external server, is for profiling the app as it runs on tomcat.
JEE is JEE, whether Tomcat or Jetty. I have heard that some people have a bias against using Jetty, like preferring starbucks over neighbourhood cafe. Coffee is coffee.
I don't understand. May be you could write another thesis to explain why you cannot debug on jetty and then deploy on tomcat.
I ran into the exact same problem, I could edit the properties of my project and see the datanucleus menu in the context so the plugin was definitely working. My issue was I was using the "Java EE" perspective in eclipse. (Juno btw). I switched to the "Java" context and my datanucleus menu was back and I was able to enable support and enable automatic enhancement.
Window -> Show perspective -> Other -> Java

Is it possible to use the Google App Engine as a backend database for Android applications?

I would like to write a client application for Android that uses the Google App Engine as a database backend. My Android client would connect to the App Engine to save information, then it would connect later for reports. Is it possible to use the App Engine as a backend like this?
If you're looking for something like the remote api that the App Engine has in python, then you'll be disappointed to find it missing in Java.
That said, absolutely nothing stops your from hitting your app and posting data either through POST / JSON / XML / any other format you can think of. The same thing goes for getting your reports back.
If security is a concern, the OAuth protocol allows you to authenticate to app engine from your android device.
This is an aside, but as far as reporting is concerned, you might not find the app engine a very suitable platform for reporting type apps. Just make sure you understand its limitations - the lack of joins, 1000 object limit, no sum / average, necessary indexes, etc. It's certainly not impossible, but do think carefully about how you're going to model your data.
Yes, it is possible.
Without more details in your question, any more details in the answer would be speculation.
Yes, its very much possible. It's something I am also currently working on.
My code uses HTTP GET and HTTP POST and I am using a RESTful service on the GAE.
I'm sorry I can't provide any code because I am still learning however the library I'm using is called RESTLET. They have libraries for both GAE and Android however I'm only using RESTLET on the GAE and I'm just using the HTTP library in the Android SDK for the client.
http://www.restlet.org/
The version you require is 2.0 M6 and not the stable release.
No.
In your response to Laurence, you said you want a direct DB connetion. A client cannot connect directly to the GAE datastore. You must write web handlers to interface between the client and your data. It doesn't have to be much, but it must be something.
Yes, it is very possible. You would not connect directly to the GAE database though. A better architecture would be to make your app hit a URL that writes to the DB. For example, you could set up a Struts 2 action that takes the values of your query parameters and then mutates and validates them as necessary before persisting them.

Resources