I am lost in the difference between web server and application server but as i could understand that web server serves a static content while application server used in case of large scale traffic to manage data!
So, can i consider Apollo server for example an application server as it can receive client queries and retrieve data from a database and manipulate it?
I know this question may make no sense for backend experts, but i am a frontend developer who try to grasp some backend concepts
Related
I am trying to make a communication between the server and the client (client is an html webpage which is locally installed on their computer) and that the client will request data from the server by its own name known to the internet (like a web domain) since my server will only handle data and not really be a website.
Note: My server will be a hosted web server since i don't want to use my own pc as a server at the moment.
for example:
On the client:
code: let Xcoordinate = askdata(myserver.com, Player1.XCoordinate)
On the Server:
code: server.onrequestdata(data){
if(data==Player1.Xcoordinate){
ReturnData(Player1.Xcoordinate)
};
};
This is just an example. But i wanted the code way to be something like that since the client's webpage is on their computer installed directly. For now I'm not really concerned about the security communication between the server and the client.
So my main question if it is possible? And what programming language can I use? At least compatible with Html or webpages.
I have been trying to search about some programming languages I can use but did not really find any in such way of code.
I found node.js and PHP but I did not find any code that happens to go with such way that I want to communicate the server and the client with.
I have gone through different blog articles to find out how a full-fledged application can be modeled and developed with React,Redux (working on front-end) with API end-points communicating with an ExpressJS server.
To my knowledge, we need to have:
a). One expressJS application developed with all possible end-points (available for an API access). This application should be running on a port e.g. 7070. This server side application will be communicating with the database.
b). Develop a React, Redux based application for front-end and run this application on a different port e.g. 8080 using webpack, gulp or grunt server.
I am sure this is not the only model. Or, maybe my concept is little weak. But this post will clarify concepts globally to all Frontend+fullstack developers. Please write your recommendations and expert opinions on followings:
Is my defined model right?
Is there a way, or possible to use ExpressJS application to throw a ReactJS application as one-page application (which process and render all defined React routes on client side).
/* a reference example of using root route handler in Express to throw an
index file (which includes bundle.js react application), this works okay,
but can not handle or render React Routes on client side; and instead
if a menu link clicked that sends request to Express but Express
application file only had '/' route to handle.
*/
app.get("/", function(req, res){
res.sendFile(dirname + "index.html"); // but this is not viable
})
If point#2 is possible then our application can run on same port right? And our application can also use Express routes as an API end-points. But I'm sure that will not be the recommended way or even possible; unless we do the server side rendering of React (in our server side ExpressJS application).
Deployment
Scenario: React+Redux+Express+DB (mongoDb, Redis, MySql or Postgres etc.) Full Stack application
Online/Cloud Hosting
Normally we are hosting our application on any 3rd party server (or cloud server). The normal shared hosting does not work unless they have NodeJS server. Most common are: Heroku, AWS, RedHat OpenShift, Nodejitsu, Microsoft Azure, Modulus, Firebase, etc.
In this case most of the server side things are easy to setup and headache free.
Local Network (Internal Company/Corporate Server) Hosting
i). Linux Bases server (any version) + SSL installed + Required DB Installation + NodeJS installation + Dedicated IP
ii). Windows Bases Server + SSL installed + Required DB Installation + NodeJS installation + Dedicated IP
Can anyone elaborate more on the internal server hosting setup procedure with all security measures in more details? I really do not know what each step that should be taken would be.
It will also be helpful if any technical person could write about application modeling as well. This will help everyone.
Note: The answers should be short in the question context (not in the question subject line context, which is quite broad). Any reference or links will be good to make answer quite short.
I have a web application that requires PUSH notifications. I looked into node.js and socket.io and have an example that's working. The question I have is, Is it possible to use socket.io only in my client side JS without running a node.js server?
Can a third party server just send requests to a proxy server and may be socket.io just listens to a port on the proxy server and sends back events to it?
Thanks,
You need a server side technology to send data back and forth via web sockets. Socket.io is a communication layer. Which means, you need to have a server side method to send data.
However,
You can use various third party services to use web sockets and notifications. They are relatively easy to use, and they have support for many other languages.
Check some of these out:
http://pusher.com/
https://www.firebase.com/
http://www.pubnub.com/
https://www.tambur.io/
https://fanout.io/
You don't need to run Node.js to have a real time push notifications. You can use a third party service that does it for you. Most of them are cheap, sometimes free for low traffic instances.
I am planning to build a social networking website like facebook supporting chat functionality . I want to implement chat functionality through Ejabberd server . Rest of the features are implemented in apache server .
I am not sure whether i need to extend Ejabberd server and port website from apache server to Ejabberd server or find a way to connect apache server to ejabberd server in case of chat request .
If i connect apache server to ejabberd server then should i go with default mnesia database or mysql.
There's no need for Apache to know about ejabberd's database — why should it?
Instead, you code your website as usually and then hook ejabberd up to it to provide the chat functionality using BOSH (for instance, via Strophe.js or something other. "Full-blown" web chat clients exist as well — there are hordes of them (plus just search the web).
There will be the problem of user authentication/registration but you can either have transient users (if you unly need public chats (rooms) or make ejabberd use the same MySQL database the website engine uses — ejabberd can do that. Another solution is to enable external authentication in ejabberd — where it uses a program (written by you) to authenticate its users; such a program is then free to query the same database the website engine uses which solves the problem of imposing a specific schema in the data base. Another bonus is that it's easier to change the database backend when needed.
I want to ask about some good practices. I have a Node.js (Express) web server and socket.io push server (in case technology matters). I can turn both of them into one application but I want them separated (they can communicate with each other if necessary). There are two reasons to do that:
It will be easier to manage, debug and develop the app;
It will be a lot easier to scale the app. I can just add another instance of push server or web server if necessary;
This is at least what I believe. The only problem is that when a client connects to the seperate socket.io server then it won't send cookies (different port, cross-domain policy).
The workaround I came up with is to put a reverse proxy (written in Node.js as well) in front and check what kind of request we are dealing with and send it to web server or push server accordingly. Great, now we have cookies in both web server and push server. The reverse proxy can be a load balancer which is an additional bonus.
It looks like a good idea to me. What do you think about this design? Perhaps any other workaround for cookie problem?
I recently did something simular, we initially used a node.js reverse proxy but ran into reliability/scalability problems. We found serving static files and proxying requests was best left to nginx. haproxy is also a very viable solution for stand alone proxying as well.
HaProxy
Nginix as a reverse proxy