📜 ⬆️ ⬇️

One-page client-server MVC JavaScript application on technologies of 1996 for Windows

The article is mainly devoted to the old classic Classic ASP - a poorly used, and at times forgotten technology from Microsoft, first released in 1996. In order not to escalate the intrigue, I will immediately note that the test application will be with Twitter Bootstrap, mustache.js, jQuery on the client and JavaScript Classic ASP + MVC on the server.

I will not lie, in 1996 I did not try to write JavaScript applications for this server platform. Since there is no intrigue in the client side of a one-page JavaScript application today, only the server side of the application will be described.

So, to the point: Classic ASP is mainly associated with VBScript. But, as it turned out, JavaScript is supported in ranges that are sufficient to build a simple multi-tier application.

The traditional Classic ASP application is a set of .asp files, in which HTML, CSS, client-side JavaScript and server-side VBScript with MS SQL queries are densely mixed. A good, mature Classic ASP application usually runs fast enough and “does not need obfuscation.”
')
However, we will go the other way. Scatter the application logic into folders:

Our application will have a single entry point - the Router.asp file. The idea is to first send all requests to Router.asp, and from there transfer control to the requested module / function (Controller / Action in MVC terminology). To do this, you need to install 404 error handler in the IIS settings for our application (this procedure is automated in a pair of scripts for IIS6 / 7 attached to the test project).

The idea is simple to disgrace: if, in response to a client request, IIS found a static resource (directory / file), it will be processed (server code) and given. If the resource was not found, the request will wrap up on Router.asp, which will already parse the request according to the MVC rules.

The rest is simple - server controllers take parameters, perform operations on the model (in a test application, these are just operations on records in the MS SQL database) and return the JSON result to the client.

The client merges the result and the display pattern (this is View in MVC notation) and updates the document.

The most fun here is that MVC applications are very convenient to generate using templates. A solution similar to a test application, or even 10 times larger, takes from 5 to 25 minutes from creation to launch on a test server. Of course, later this g-application still needs to be cut, but that's another story.

I don’t see any particular advantages of Classic ASP technology over Node.js, which finally made JavaScript on the server popular, except, perhaps, the fact that someone like me is easier to mess around with an old familiar technology stack, which is already here 19 years old.

A test application generated by the model is located here: https://github.com/hardsome/helpdesk

Warning for those who will try to run a test application on their own: the biggest difficulty when installing a test application for some reason is the connection string to the database. I can not help much - you need to be able to configure ODBC. The rest of the settings related to the installation of the default pages and the router, I packed in the application setup scripts. The test application is more or less run-in on the Windows32 platform, but it can work on Windows64 with certain tuning skills.

Other JavaScript server solutions: http://en.wikipedia.org/wiki/Comparison_of_server-side_JavaScript_solutions

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


All Articles