How to develop 100% server applications?

TL DR

What structure can I use to store 100% application logic on the server, providing RIA interactivity?

Explanation

In the 90s, it was possible to create a 100% server application with regular PHP. But then the requirements for interactivity on the page increased, and more and more application logic was transferred to client javascript. Today, thanks to the websocket and the fully dynamic DOM, server applications can again be created to meet all the interactivity requirements of the page. All that is needed on the client is a shared javascript library that synchronizes the DOM with the server via websocket.

Although I believe that this approach to web development has its merits , I do not want to discuss the pros and cons of this technique here.

My question is about modern frameworks available by the end of 2014 that support this style of development. The experimental framework is also good as far as their architecture is clear enough. I do not need a list of styles for existing frameworks. I would like to see some frameworks that implement such a software architecture or, if there is no such structure, I would like to learn about those that are closest to the ideal.

My own research so far shows that Meteor is on the right track, but still encourages too much javascript for the client application, and it connects the server platform with the client platform (i.e. javascript). I read about the Trello architecture , which greatly reduces the client processor to the template, but the templates and their associated template / binding libraries are related to the fact that I would like to return to the server side. Amazon AppStream will support all UI logic, but it is prohibitively expensive for web development, especially when users leave applications sitting in the background.

Update: All answers are still focused on Meteor. I removed the Meteor tag because it might be misleading. I mentioned Meteor because the Meteor view showed that I have a choice whether I want to run the code on the server side or on the client side. It is now clear that Meteor will not transmit any user interface over the cable, just data. Thus, the client requires half the application, at least in the form of templates.

Update 2: I found Remote Events for XML (REX) , a protocol that can be used to remotely control client-side DOM from a server application. There is no clear way to send user actions (clicks, changes) back to the server, but perhaps they can be defined as extension events in REX, which is allowed by the specification. However, this is a protocol. No real software that I could use.

Update 3: I have one thing to make clear. Simply accepting server templates and translating them to client templates, which are then executed on the client, are not taken into account as a 100% server-side application logic. Although this framework allows me to use the server-side API, they will inevitably burden the client and expose most of the application code. I am looking for something that only sends the rendered content (and the general event hooks) to the client.

In addition, with regard to widgets / controls, the framework may allow client code to handle random cases (new low-level widgets), but it should not require implementation on the client side for typical application logic (high-level templates and widgets).

+6
source share
8 answers

Vaadin seems to be very close to what you want. I have no experience with this, but from what I read, it should allow you to write your entire application (including user interface logic) in server-side code (Java). This structure takes care of the inevitable material of the client side (Ajax).

References

+2
source

Honestly, Meteor is not what you are looking for. The main advantages that the Meteor framework offers are not the parts you want to use.

I honestly don't know which app is right for you. But this is definitely not a Meteor.

+4
source

You might want to consider using a combination of tools to achieve this. A meteor is not the best approach for you, because it relies on client-side JavaScript and only passes data to the wire.

I suggest using Node.js as a server since it is the main Meteor server. You can then use the server-side template to model the patterns, such as jade or similar, to display html. This will make your application dynamic, but less client dependent. You lose all reactivity, but this is a compromise on server rendering.

+1
source

The meteor is very modular, so you can use it, but it is in a very unconventional sense.

You will need to delete the contents of the client / web base. This is included in the meteor-platform package.

Better to have a barebones app

 meteor create myapp meteor remove meteor-platform 

Now you can add back several packages that make development useful (you can remove any of them):

 meteor add logging ddp mongo check underscore random ejson 

You now have a 100% server application.

This application is slightly different from the usual Meteor application in that it does not have a “web server” serving any client-side code, its almost pure server application.

First you need to delete any template code (myapp.html, myapp.css, myapp.js) and create a file with the main = function() { ... } method that your application contains. Keep in mind that you need something in this method that your application supports, for example, a socket listener (maybe express js?). When the application starts, it stops

Again, I'm not sure what exactly you want with a 100% server application, if you are going to use Meteor over Node, which gives you the option to have synchronous code, built-in mongo and DDP, this could be the way to go. If you do not want the client-side material or something else you do not need, you can delete it using the method above.

+1
source

Use something with a server-side event model, for example:

Most of Blueprint's philosophy and syntax comes from XForms. We chose the full declarative language, because it was the only way to work effectively on a wide range of devices, some of which have no scripts at all. Using declarative syntax, we can encapsulate and hide the specifics of scripts. In some cases, the code can work on the phone, in another case, for example, XHTML, we can put the logic on our servers. This is an ideal way to deal with various environments and their capabilities.

And the Orbeon form has a command line interface using a protocol and filter implementation called XPL:

You can use Orbeon Forms to create stand-alone command line applications that work with pipelines. Use cases include: creating a hard copy of a website, importing or exporting XML data to and from a relational database, testing pipelines, automating repetitive operations on XML files (selection, conversion, aggregation, etc.). Orbeon Forms becomes your XML tool.

Orbeon Forms comes with a command line interface (CLI). The easiest way to run it is to use the orbeon-cli.jar executable and pass the pipeline file to it:

 java -jar orbeon-cli.jar pipeline.xpl 

In this case, the pipeline can use relative URLs or, if absolute URLs are used, it can use either a file: a protocol for accessing files, or, equivalently, an oxf protocol:

Sometimes it is better to group files in an isolated resource environment, addressed by the oxf: protocol. This is the standard way to access resources (files) in web applications, but it is also useful when using command line applications. In such cases, specify the root directory of the resource manager with the -r option, for example:

 java -jar orbeon-cli.jar -r . oxf:/pipeline.xpl 

or

 java -jar orbeon-cli.jar -r C:/my-example oxf:/pipeline.xpl 

References

+1
source

This is a rather interesting question, given that many people try to create applications on the client side and use BeASS (Backend As a Service). The following thoughts come from head to head:

Since I'm most familiar with Dojo Tookit, you can do the following:

1. Zend and Dojo Integration

Zend (one of the best contributors to PHP and Apache Server) has integrated its infrastructure with Dojo. As you can see here http://framework.zend.com/manual/1.12/en/zend.dojo.view.html , using PHP code, they have a way to render the Dojo widget on the client side.

2. Dojo and Node.JS integration

Easy integration with Dojo and Node.js does this. http://dojotoolkit.org/documentation/tutorials/1.8/node/

But Dojo widgets (fully interactive, RIA, etc., as you can see here http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/themes/themeTester.html ) can be displayed on the side code server and sent to the client. See http://dojotoolkit.org/reference-guide/1.9/dijit/_AttachMixin.html and this is http://jamesthom.as/blog/2013/01/15/server-side-dijit/

3. Template frames

As in paragraph 2, there are many template templates that exist for JavaScript. In the wild, there can be many frameworks that can populate these templates on the server side and simply send the viewing code to the client.

A word of caution in the links above. Dojo itself is pretty hard to learn at first (later its strength just amazes you!), But the links above are pretty powerful stuff, pretty hard to learn.

Personally, I think that we have moved into an era when the browser can do anything, and the server just sits there for persistent data / facilitates the work of several users and authentication.

I will post more links as and when I come across more such frameworks, including Pt examples. 3

EDIT: Here's something happening in PHP that effectively reduces user JavaScript events to nothing but network calls to the server. http://www.xisc.com/

+1
source

I have built-in applications in this spirit, mainly because I need to support older versions of IE that did not handle client-side work. The main approach is to use partial parts of the server and load them through ajax. Provides you with an RIA while keeping the logic on the server.

I did this in asp.net webforms, asp.net mvc, rails and node / express.

An example is the form editing the record. Using knockout, angular, jquery, etc., your form will be part of the DOM and you will load the data through ajax and then bind if you use something like jquery, or let the structure do two-way binding in angular, knockout , ...

In this approach, instead, you download the partial from the server, the DOM and bindings will be done on the server, and you completely replace the contents of the div with the response.

The specifics depend on the language you use, but I have a commercial application written using asp.net mvc that does just that and the internal tool that we use in our company, written in node / express / jade, which does this as well. It is much easier to follow the code, and you get much more browser compatibility. However, that is not where the industry is going. For the new code, we use knockout and angular.

+1
source

I suggest using Oracle ADF .
It has many user interface components and has built-in ABC (ADF Business Componenet), which provides a good abstraction at the data level, so you can retrieve data from a database or web service or file or ...

You can also use JHeadStart , which is a kind of code generator, it creates web pages and modules for you, and you can create your network application very quickly.

+1
source

Source: https://habr.com/ru/post/980000/


All Articles