Discover FortressJS - A fast, secure and easy I/O framework


Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content


Pages are integrated natively in FortressJS. They are automaticaly mapped by their name, and can be configured.

You can use any html engine with pages.

Understand Pages

A page is composed of :

  • a .page.js file
  • a .conf.js file
  • a view folder

The .page.js file is a controller and let you define what your page do, what engine is used, map data etc

The .conf.js file is the configuration of your page. You can easily change uri, state etc.

The view folder contains views of your pages. View files ended by .html.

You can access your view with : this.view.VIEW_NAME

For example, if you have created a file name hello.html, you can access it with : this.view.hello

Set the uri of a Page

Our about page is mapped on /about. To change that, modify the uri param to about-us :

Let's go :

Change the uri of the page
var aboutConf=
"pos": 0, // position if menu or conflict
"uri": "about" // page uri if not default page
module.exports = aboutConf

If it's green, it's good !

Change dynamically a view

Now, you will send a view regarding the view parameter in the url. We are calling the page /exercise with the parameter view=something. You don't know the value of something, but the something value is the right to finish this exercise. So you need to select a view by the view value.

Change the view regarding url get param
module.exports = homePage;
function homePage(pageConf)
child_process.execSync("echo 'TECHIO> open -p 8080 /?view=home' > /proc/1/fd/1");
this.code = function(req, res)
// change this algorithm to select a view by the get param
if(req.get.view && req.get.view == "home")
else res.end(this.view.error);

if(req.get.view && this.view[req.get.view])

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content