Loading...

Source code structure

In this article

Web source code structure

Kindie Web Admin is built by SailsJS, is a Javascript framework designed to resemble the MVC architecture from frameworks like Ruby on Rails. It makes the process of building Node.js apps easier, especially APIs, single page apps and realtime features, like chat…

The api Folder
This folder is composed from a buch of sub-folders:

  • the adaptersfolder contains the adapters used by the application to
    handle database connections
  • the controllers folder contains the application controllers
  • the application’s models are stored in the models folder
  • in the policiesfolder are stored rules for application user access
  • the api services implemented by the app are stored in the services folder

The assets Folder
The assets folder contains subdirectories for the Javascript and CSS files that should be loaded during runtime. This is the best place to store auxiliary libraries used by your application.

The public Folder
Contains the files that are publicly available, such as pictures your site uses, the favicon, etc.

The config Folder
This is one of the important folders. Sails is designed to be flexible. It assumes some standard conventions, but it also allows the developer to change the way Sails configures the created app to fit the project’s needs. The following is a list of configuration files present in the config folder:

  • adapters.js – used to configure the database adapters
  • application.js – general settings for the application
  • assets.js – asset settings for CSS and JS
  • bootstrap.js – code that will be ran before the app launches
  • locales– folder containing translations
  • policies.js – user rights management configuration
  • routes.js – the routes for the system
  • views.js – view related settings

The sails.js documentation contains detailed information on each of these folders.

The views Folder
The application’s views are stored in this folder. Looking at its contents, we notice that the views are generated by default as EJS (embedded JavaScript). Also, the views folder contains views for error handling (404 and 500) and also the layout file (layout.ejs) and the views for the home controller, which were generated by Sails.

Note: You can refer full specs here: https://sailsjs.com/documentation/anatomy

Have fun!

About zsadmin

Think different - Steve Jobs

We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies.