Skip to main content

Create Web Module Structure

Web module id

The id of web module must start with the Bundle-Symbolic-Name (non-alphanumeric characters replaced with hyphens), then contain the character - and desired web module name, e.g: com-sabre-redapp-example-my-web-module

Adding web module to Red App

To create Red App with web module create basic Red App (refer to other parts of this document for information about setting up dev environment and generating red app template.

  1. create web-src directory in there

  2. cd into it

  3. run ngv init follow the wizard. Web module template will be created.

    Important
    The web module id must match the pattern: Bundle-Symbolic-Name-My_Web_Module_Name (non-alphanumeric characters replaced with hyphens)
  4. Add web extension information into plugin.xml file, ex.

Example of plugin.xml file
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
          point="com.sabre.edge.dynamo.web.module">
          <modules>
                <module id="<web-module-id as set during ngv init>"/>
          </modules>
    </extension>

</plugin>

Building and deploying

To compile web module run ngv build command inside web-src/module-id/. build directory will be created, with prod subdirectory in it. To run web module in SR360 copy everything from prod directory into web directory, located on the same level as web-src, ex.

Structure of webmodule directory with compiled webmodule
  ->META-INF
  ->...
  ->web-src
    ->my-red-app-web-module
	  ->build
	    -> prod
      ->...
  ->web

concierge.conf.js

Concierge.conf.js file can make webmodule deployments easier. Create concierge.conf.js within webmodule directory:

Structure of webmodule directory with concierge.conf.js file
  ->META-INF
  ->...
  ->web-src
    ->my-red-app-web-module
	  ->concierge.conf.js
  ->web

Body of concierge.conf.js should like in presented below example. Provide path where compiled webmodule should be deployed under dist-copy directive.

Example of concierge.conf.js file
module.exports = {
    metadata: {
        'dist-copy' : {
            'prod': '../../web/my-red-app-web-module'
        }
    }
}

Since now building webmodule with command ngv build will deploy compiled webmodule into declared path.