Class: NA

NA

new NA()

Creates a new instance of NodeAtlas Website.
Source:

Namespaces

currentRouteParameters
currentVariation
modules
variations
webconfig
websiteController[]

Members

(private) afterGenerates :Object

Represent the function called after all assets generation.
Type:
  • Object
Source:

(private) afterNewProject :Object

Represent the function called after create a project.
Type:
  • Object
Source:

(private) afterRunning :Object

Represent the function called after the server was started.
Type:
  • Object
Source:

appLabels :Object

All internationalize labels from `NA#appLanguage` file.
Type:
  • Object
Source:

appLanguage :String

Name of file which contains language error messages. The name of file is without extension.
Type:
  • String
Default Value:
  • "default"
Source:

(private) configuration :Object

Represent options passed through API.
Type:
  • Object
Source:

nodeAtlasModulesPath :String

Folder which contain the `node-atlas` node_modules.
Type:
  • String
Default Value:
  • « path/to/node-atlas/node_modules/ »
Source:

serverPhysicalPath :string

OS absolute path which contains NodeAtlas folders and files.
Type:
  • string
Default Value:
  • « The path where `node-atlas` module is. »
Source:

sessionStore :Object

A default session loaded with `NA#webconfig.sessionKey` and `NA#webconfig.sessionSecret` or `NA.webconfig#sessionKey` and `NA#webconfig.session`.
Type:
  • Object
Source:
See:

webconfigName :string

Name of the webconfig used for run the website.
Type:
  • string
Default Value:
  • "webconfig.json".
Source:

websiteModulesPath :String

Folder which contain the current website node_modules.
Type:
  • String
Default Value:
  • « path/to/current/website/node_modules/ »
Source:

websitePhysicalPath :String

OS absolute path that contains webconfig and website.
Type:
  • String
Default Value:
  • « `--directory` value » || « Path from NodeAtlas is called ».
Source:

Methods

(private) alreadyParse(newPath, allCssFiles, inject)

Check if a file have been already parsed.
Parameters:
Name Type Description
newPath string Current file tested.
allCssFiles Array.<string> Files already tested.
inject string State for know if injection will be authorized.
Source:

(private) atlasConfigurations(session, optionSession)

Allow you to configure your own modules configuration.
Parameters:
Name Type Description
session Object Session Object.
optionSession Object Property for Object Session.
Source:

(private) atlasRoutes(callback)

Run the Server Routes.
Parameters:
Name Type Description
callback atlasRoutes~callback Calling next processus after route was loaded.
Source:

(private) atlasServer()

Run the Server of NodeAtlas.
Source:

(private) atlasSessions()

Set the Sessions variables possibility.
Source:

(private) changeDomCommon(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath)

Intercept DOM from common file.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
Source:

(private) changeDomSpecific(dom, currentVariation, currentRouteParameters, request, response, currentPath)

Intercept DOM from specific file.
Parameters:
Name Type Description
dom string DOM Generated.
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
currentPath string Url from `url` value for this render.
Source:

(private) changeVariationCommon(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath)

Intercept Variation from common file.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
Source:

(private) changeVariationSpecific(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath)

Intercept Variation from specific file.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
Source:

(private) downloadAllModules(err)

Download all module with `npm install` based on package.json dependencies if a module is not found.
Parameters:
Name Type Description
err Object Allow to know what module was not found.
Source:

(private) emulatedIndexPage()

Create a « Overview » page to « / » url with all of page accessible via links.
Source:

(private) enableLessProcess()

Active Mechanism for generate Less files.
Source:

(private) enableStylusProcess()

Active Mechanism for generate Stylus files.
Source:

(private) executeRequest(getSupport, postSupport, putSupport, deleteSupport, objectPath, options, path)

Ask for a page in GET and in POST.
Parameters:
Name Type Description
getSupport boolean This page can be requested by GET ?
postSupport boolean This page can be requested by POST ?
putSupport boolean This page can be requested by PUT ?
deleteSupport boolean This page can be requested by DELETE ?
objectPath string The list of Url match for obtain response.
options Object Option associate to this url.
path string The Url in routes' webconfig.
Source:

(private) generateStartingProject(fallback)

Copy content of a project from `node-atlas/templates` into current directory.
Parameters:
Name Type Description
fallback generateStartingProject~fallback The next steps if no init command exist.
Source:

(private) httpServer()

A simple HTTP server.
Source:

(private) httpServerParse()

Add some parser for parse request and response.
Source:

(private) httpServerPublicFiles()

Set the public directory for asset like CSS/JS and media.
Source:

(private) improveWebconfigBase()

Set all default webconfig's value into `NA#webconfig`.
Source:

(private) initGlobalVar()

Set main variables for application and language error messages.
Source:

(private) initGlobalVarRequiredNpmModules()

Set main variables for webconfig.
Source:

(private) initWebconfig(callback)

Decide to run a « Simple Web Server » or a « With Weconfig Server » depending to webconfig opening success. If webconfig is correctly openned, the `NA#improveWebconfigBase` and `callback` function will be run, else, just `NA#simpleWebServer` will be run.
Parameters:
Name Type Description
callback initWebconfig~callback Calling next processus if webconfig opening is a success.
Source:

(private) injectCss(dom, injection, mainCallback)

Inject the content of a stylesheets file into a DOM.
Parameters:
Name Type Description
dom string The ouptput HTML.
injection string | Array.<string> Represent the injectCss property injection to the template.
mainCallback injectCss~mainCallback The next steps after injection.
Source:

(private) injectCssAuth(pathFile, allCssFiles, inject)

Inject Css if not already injected.
Parameters:
Name Type Description
pathFile string Current file for injection.
allCssFiles Array.<string> Files already tested.
inject string State for know if injection will be authorized.
Source:

(private) intoBrowserAndFiles(data, currentVariation, currentRouteParameters, request, response, currentPath)

Inject CSS into DOM if needed.
Parameters:
Name Type Description
data string DOM Generated.
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
currentPath string Url from `url` value for this render.
Source:

(private) lineCommandConfiguration()

Set line command options usable when NodeAtlas is executed as CLI.
Source:

(private) loadController(controller, callback)

Load a controller file.
Parameters:
Name Type Description
controller string The name of controller file we want to load.
callback loadController~callback Next steps after controller loading.
Source:

(private) loadListOfExternalModules(callback)

Load the modules adding by the website.
Parameters:
Name Type Description
callback loadListOfExternalModules~callback Next steps after loading of additional modules.
Source:

(private) loadListOfNativeModules()

Require each set of native modules from Node.js API to `NA#modules`.
Source:

(private) loadListOfRequiredNpmModules()

Add all modules loaded from npm to `NA#modules`.
Source:

(private) loadProcessModules()

Add npm modules for minification, obfuscation, compression, optimization and transformation.
Source:

(private) loadServerModules()

Add npm modules to run a Server web.
Source:

(private) loadTemplatingModules()

Add npm modules to manipulate HTML render.
Source:

(private) loadUtilsModules()

Add npm modules to enhance NodeAtlas.
Source:

(private) moduleRequired(callback)

Load modules or install modules.
Parameters:
Name Type Description
callback moduleRequired~callback Run next steps if all module are correctly loaded.
Source:

(private) openConfiguration(configName) → {Object}

Read a JSON file and return a literal Object else kill process.
Parameters:
Name Type Description
configName string File name (on file path + name in relative). Base folder is the folder where is `webconfig.json`.
Source:
Returns:
Literal object of JSON file.
Type
Object

(private) openTemplate(currentRouteParameters, templatesPath, callback)

Open a temlpate file.
Parameters:
Name Type Description
currentRouteParameters Object Parameters set into `routes[]`.
templatesPath Object Path to template file.
callback openTemplate~callback Next steps after opening file.
Source:

(private) openVariation(variationName, languageCode, errorDisabled) → {Object|boolean}

Open a variation file.
Parameters:
Name Type Description
variationName string Name of JSON file.
languageCode string Current language for this variation.
errorDisabled boolean | undefined Force no error message.
Source:
Returns:
Return all data from JSON or false if an error occured.
Type
Object | boolean

(private) pageNotFound()

Define a page to display when no url match in route or in `NA#httpServerPublicFiles` directory.
Source:

(private) prepareCssInjection(allCssFiles, injection)

Verify if common or specif file without double are ready for injection CSS.
Parameters:
Name Type Description
allCssFiles Array.<string> Files already tested.
injection string | Array.<string> Represent the injectCss property injection to the template.
Source:

(private) prepareRenderLanguage(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath, path)

Create some variable for manage path for render.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
path string Url path for this render.
Source:

(private) prepareRenderParameters(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath, path)

Create some variable for manage parameters into render.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
path string Url path for this render.
Source:

(private) prepareRenderPath(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath, path)

Create some variable for manage path for render.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
path string Url path for this render.
Source:

(private) prepareRenderVariation(currentVariation, currentRouteParameters, request, response, templatesPath, currentPath, path)

Create some variable for manage variation into render.
Parameters:
Name Type Description
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
templatesPath string Path to the based template.
currentPath string Url from `url` value for this render.
path string Url path for this render.
Source:

(private) redirect(currentRouteParameters, request, response)

Redirect a page to an other page if option page is set for that.
Parameters:
Name Type Description
currentRouteParameters Object All information associate with the redirection.
request Object Initial request.
response Object Initial response.
Source:

(private) render(path, options, request, response)

Generate the HTML output for send to client.
Parameters:
Name Type Description
path string The url listening.
options Object Option associate to this url.
request Object Initial request.
response Object Initial response.
Source:

(private) renderTemplate(data, currentVariation, currentRouteParameters, request, response, currentPath)

Write file or/and send response.
Parameters:
Name Type Description
data string HTML DOM ready for sending.
currentVariation Object Variations for the current page.
currentRouteParameters Object All parameters from current route.
request Object Information from request.
response Object Information from response.
currentPath string Url from `url` value for this render.
Source:

(private) request(path, options)

Listen a specific request.
Parameters:
Name Type Description
path string The url listening.
options Object Option associate to this url.
Source:

(private) requestRegex(getSupport, postSupport, putSupport, deleteSupport, objectPath, options, path, currentRouteParameters)

Listen a specific request (Regex Part).
Parameters:
Name Type Description
getSupport boolean This page can be requested by GET ?
postSupport boolean This page can be requested by POST ?
putSupport boolean This page can be requested by PUT ?
deleteSupport boolean This page can be requested by DELETE ?
objectPath string The list of Url match for obtain response.
options Object Option associate to this url.
path string The Url in routes' webconfig.
currentRouteParameters Object Parameters for this route.
Source:

(private) response(request, response, data, currentRouteParameters, currentVariation)

Send HTML result to the client.
Parameters:
Name Type Description
request Object Initial request.
response Object Initial response.
data string HTML DOM ready for sending.
currentRouteParameters Object Parameters set into `routes[]`.
currentVariation Object Variations for the current page.
Source:

(private) routesPages(callback)

Crawl all routes and execute each file with a request that it emit by client.
Parameters:
Name Type Description
callback routesPages~callback Calling next processus after route was loaded.
Source:

(private) saveTemplateRender(data, templateRenderName)

Generate a template into an HTML file in folder `generatesRelativePath`.
Parameters:
Name Type Description
data string Content of file generated.
templateRenderName string The filename of file generated.
Source:

(private) server()

The global HTTP server.
Source:

(private) setCompressionDirectiveAsWebconfigBase()

Set default webconfig's value from possibly external files for compress files.
Source:

(private) setDirectoriesAsWebconfigBase()

Set default webconfig's value possibly undefined from webconfig.
Source:

(private) setExternalRoutesAsWebconfigBase()

Set default webconfig's value from possibly external routes.
Source:

(private) setHttpValuesAsWebconfigBase()

Set default Http Port value possibly undefined from webconfig.
Source:

(private) setPreprocessorDirectiveAsWebconfigBase()

Set default webconfig's value from possibly external files for preprocessor files.
Source:

(private) setSupport(support, path, options)

Affect support of GET/POST to a route.
Parameters:
Name Type Description
support boolean Type of support GET or POST.
path boolean Instruction support for all page.
options boolean Instruction support for current page.
Source:

(private) simpleWebServer()

Run NodeAtlas with targeted directory (without webconfig) as a « public » directory.
Source:

(private) startingHttpServer()

Start a real NodeAtlas Server.
Source:

(private) templateEngineConfiguration()

Set configuration of Template Engine.
Source:

(private) urlGeneratingAssets()

Compress all assets for generate render into `generatesRelativePath`.
Source:

(private) urlGeneratingPages()

Open all pages for generate render into `generatesRelativePath`.
Source: