Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Oracle JET(OJET) Interview Questions and Answers

Ques 21. How to start a Web App in Oracle JET (OJET)?

Use the Oracle JET command-line interface (CLI) to scaffold an app that contains a blank template or one pre-configured Starter Template with a basic layout, navigation bar, or navigation drawer. Each Starter Template is optimized for responsive web apps. Additionally, Starter Templates support TypeScript development should you wish to create your app in TypeScript. After scaffolding, you can modify the app as needed.

Before you can create your first Oracle JET web app using the CLI, you must also install the prerequisite packages if you haven’t already done so. For details, see Install Oracle JET Tooling.

To scaffold an Oracle JET web app:

1) At a command prompt, enter ojet create with optional arguments to create the Oracle JET app and scaffolding.

ojet create [directory]
            [--template={template-name:[web]|template-url|template-file}] 
            [--typescript]
            [--use-global-tooling]
            [--help]

For example, the following command creates a web app in the my-web-app directory using the web version of the navbar template:

ojet create my-web-app --template=navbar

To scaffold the web app using the same Starter Template but with support for TypeScript version 4.8.4 development, add the --typescript argument to the command:

ojet create my-web-app --template=navbar --typescript

To scaffold the web app that will use the globally-installed @oracle/oraclejet-tooling rather than install it locally in the app directory, enter the following command:

ojet create my-web-app --use-global-tooling 

2) Wait for confirmation.

The scaffolding will take some time to complete. When successful, the console displays:

Oracle JET: Your app is ready! Change to your new app directory my-web-app and try ojet build and serve...

3) In your development environment, update the code for your app.

Is it helpful? Add Comment View Comments
 

Ques 22. What are the different folders and configurations available under Oracle JET(OJET) project structure?

The app folders contain the app and configuration files that you will modify as needed for your own app.

Directory or FileDescription

node_modules

Contains the Node.js modules used by the tooling.

scripts

Contains template hook scripts that you can modify to define new build and serve steps for your app. See Customize the Web App Tooling Workflow

src

Site root for your app. Contains the app files that you can modify as needed for your own app and should be committed to source control.

The content will vary, depending upon your choice of template. Each template, even the blank one, will contain an index.html file and a main.js RequireJS bootstrap file.

Other templates may contain view templates and viewModel scripts pre-populated with content. For example, if you specified the navbar template during creation, the js/views and js/viewModels folders will contain the templates and scripts for a web app that uses a nav bar for navigation.

.gitignore

Defines rules for app folders to ignore when using a GIT repository to check in app source. Users who do not use a GIT repository can use ojet strip to avoid checking in content that Oracle JET always regenerates. Note this file must not be deleted since the ojet strip command depends on it.

oraclejetconfig.json

Contains the default source and staging file paths that you can modify if you need to change your app's file structure.

package.json

Defines npm dependencies and project metadata.

Is it helpful? Add Comment View Comments
 

Ques 23. What about OJET build Command Options for Web Apps?

Use the ojet build command with optional arguments to build a development version of your web app before serving it to a browser.

The following table describes the available options and provides examples for their use.

OptionDescription

--theme

Theme to use for the app. The theme defaults to redwood.

You can also enter a different themename for a custom theme as described in About CSS Variables and Custom Themes in Oracle JET.

--themes

Themes to include in the app, separated by commas.

If you don’t specify the --theme flag as described above, Oracle JET will use the first element that you specify in --themes as the default theme.

--cssvars

Injects a Redwood theme CSS file that supports working with CSS custom properties when you want to override CSS variables to customize the Redwood theme, as described in About CSS Variables and Custom Themes in Oracle JET.

--sass

Manages Sass compilation. If you add Sass and specify the --theme or --themes option, Sass compilation occurs by default and you can use --sass=false or --no-sass to turn it off.

If you add Sass and do not specify a theme option, Sass compilation will not occur by default, and you must specify --sass=true or --sass to turn it on.

Is it helpful? Add Comment View Comments
 

Ques 24. How to serve a Web App in Oracle JET (OJET)?

Use ojet serve to run your web app in a local web server for testing and debugging. By default, the Oracle JET live reload option is enabled which lets you make changes to your app code that are immediately reflected in the browser.

To run your web app from a terminal prompt:

At a terminal prompt, change to the app’s root directory and use the ojet serve command with optional arguments to launch the app.

ojet serve [--server-port=server-port-number --livereload-port=live-reload-port-number
            --livereload
            --sass
            --build
            --cssvars=enabled|disabled
            --theme=themename --themes=theme1,theme2,...
            --server-only
           ]

Is it helpful? Add Comment View Comments
 

Ques 25. What about Oracle JET (OJET) serve Command Options and Express Middleware Functions?

Use ojet serve to run your web app in a local web server for testing and debugging.

The following table describes the available ojet serve options and provides examples for their use.

Oracle JET tooling uses Express, a Node.js web app framework, to set up and host the web app when you run ojet serve. If the ready-to-use ojet serve options do not meet your requirements, you can add Express configuration options or write Express middleware functions in Oracle JET’s before_serve.js hook point. For an example that demonstrates how to add Express configuration options, see Serve a Web App to a HTTPS Server Using a Self-signed Certificate, and, for an example that uses an Express middleware function, see Serve a Web App Using Path-based Routing.

The before_serve hook point provides options to determine whether to replace the existing middleware or instead prepend and append a middleware function to the existing middleware. Typically, you’ll prepend a middleware function (preMiddleware) that you write if you want live reload to continue to work after you serve your web app. Live reload is the first middleware that Oracle JET tooling uses. You must use the next function as an argument to any middleware function that you write if you want subsequent middleware functions, such as live reload, to be invoked by the Express instance. In summary, use one of the following arguments to determine when your Express middleware function executes:

  • preMiddleware: Execute before the default Oracle JET tooling middleware. The default Oracle JET tooling middleware consists of connect-livereload, serve-static, and serve-index, and executes in that order.
  • postMiddleware: Execute after the default Oracle JET tooling middleware.
  • middleware: Replaces the default Oracle JET tooling middleware. Use if you need strict control of the order in which middleware runs. Note that you will need to redefine all the default middleware that was previously added by Oracle JET tooling.
OptionDescription

server-port

Server port number. If not specified, defaults to 8000.

livereload-port

Live reload port number. If not specified, defaults to 35729.

livereload

Enable the live reload feature. Live reload is enabled by default (--livereload=true).

Use --livereload=false or --no-livereload to disable the live reload feature.

Disabling live reload can be helpful if you’re working in an IDE and want to use that IDE’s mechanism for loading updated apps.

You can also configure the interval at which the live reload feature polls the Oracle JET project for updates by configuring a value for the watchInterval property in the oraclejetconfig.json file. The default value is 1000 milliseconds.

build

Build the app before you serve it. By default, an app is built before you serve it (--build=true).

Use --build=false or --no-build to suppress the build if you’ve already built the app and just want to serve it.

theme

Theme to use for the app. The theme defaults to redwood.

You can also enter a different themename for a custom theme as described in About CSS Variables and Custom Themes in Oracle JET.

themes

Themes to use for the app, separated by commas.

If you don’t specify the --theme flag as described above, Oracle JET will use the first element that you specify in --themes as the default theme. Otherwise Oracle JET will serve the app with the theme specified in --theme.

--cssvars

Injects a Redwood theme CSS file that supports working with CSS custom properties when you want to override CSS variables to customize the Redwood theme. For details about theming with CSS variables, see About CSS Variables and Custom Themes in Oracle JET.

sass

Manages Sass compilation. If you add Sass and specify the --theme or --themes option, Sass compilation occurs by default and you can use --sass=false or --no-sass to turn it off.

If you add Sass and do not specify a theme option, Sass compilation will not occur by default, and you must specify --sass=true or --sass to turn it on.

server-only

Serves the app, as if to a browser, but does not launch a browser. Use this option in cloud-based development environments so that you can attach your browser to the app served by the development machine.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook