The application consists of two layers: the server and the app.
The server:
The server application is a node.js application located under the server folder. It is developed using express.js.
Installation & Running:
- Enter "./server/npm install" to install.
- Enter "node document-storage.js" to run the server. A server should start running on your localhost at port 3412. It should be accessible by http://localhost:3412/documents
Server has the following responsibilities:
- Prodiving a REST API for accessing/modifying documents. It supports all CRUD (Create/Read/Update/Delete) operations on documents. Storage and persistency handled by document-storage.js.
- Serving the frontend app located at the app folder.
- Serving the dummy download.html file providing information about the downloaded file.
The Frontend App:
The frontend app is a backbone.js application. It is loaded via Require.js. Less is used as CSS preprocessor. It is served by the server application.
Installation & Running:
-
Enter "./app/bower install" to install necessary components. Bower is a package manager. You migt need to install it by "npm install -g bower" first if you don't have it on your system.
-
When the server app is running, visit "http://localhost:3412/app" on your browser to view the application.
Possible Improvements:
The following changes can be done to improve the application.
- Document creation/deletion operations can be added to frontend.
- An xml file or simple database can be used by ./server/document-storage.js for persistency.
- A build script can be written for the frontend app. (to optimize js/css files)
- Automated tests can be written and integrated to the build. (It would have been better if they were written first of course!)