-
Book Overview & Buying
-
Table Of Contents
Learning Single-page Web Application Development
By :
There's lots of consensus among the main frameworks and libraries about how to do MVC architecture, declarative bindings, and so on. Your choice will deeply influence your architecture.
Some frameworks recommend a specific directory structure to be followed, but some others are more flexible.
We'll adopt a boilerplate to build our API in the next chapters, and we'll discuss more about server structure and code organization; we should always think with regard to maintenance and scalability of the application. For now, let's see an example of a basic structure in detail that is very common to all MVC patterns:

A simple basic SPA folder structure consists of the following:
Note that we don't have any folder to deal with routes, but from a basic application, we can put our routing logic in our app.js or server.js file.
In Node.js applications, often the initialization file is called app.js or server.js and is always in the root directory of the application.
Despite being a very basic structure, it is sufficient for understanding the basics of folder names. Of course, as things are getting complex, we need to re-evaluate this structure (maybe include a folder for Sass or Less files and also add some other things). However, in the course of the book, we will see some alternatives.
Change the font size
Change margin width
Change background colour