A standard webpage that makes use of a generated REST client library. The REST
client library is generated by OpenAPI Generator
and used directly by inline javascript <script>
tags.
This sample webpage does not make use of any Single-Page Application frameworks in effort to stay focused on building and usage of the generated REST library.
To serve the files locally while working on the .HTML file, the following maven command may be issued:
./mvnw jetty:run
To generate the REST client library, the following steps are taken:
The maven goal openapi-generator-maven-plugin:generate-sources
is run. This
downloads the OpenAPI specification and generates source targeting ECMA Script
Flow
The next step installs Node and NPM into a project-specific temporary
location. This is accomplished using the maven goal of
frontend-maven-plugin:install-node-and-npm
. All subsequent runs of npm
or
related commands will use this installation.
The maven goal frontend-maven-plugin:npm
is run with the single argument
"install". When receiving this command, NPM will automatically download all
dependencies required for compiling the REST client library.
The maven goal frontend-maven-plugin:npm
is run a second time; this time to
install the browserify tool for preparing the
transpiled library to be used in a web browser.
With dependencies and tools installed, the frontend-maven-plugin:npm
goal is
run once again. This execution uses arguments "run build:lib" to call the
build script defined in package.json. This script transpiles from ECMA Script
Flow into ECMA Script 6.