Numeric Production Mechanism

    web_plsql

    0.4.1 • Public • Published

    NPM Version NPM Downloads Linux Build Build status Coverage Status

    Oracle PL/SQL Gateway Middleware for the Express web framework for Node.js

    This Express Middleware is a bridge between a PL/SQL application running in an Oracle Database and an Express web server for Node.js. It is an open-source alternative to mod_plsql, the Embedded PL/SQL Gateway and ORDS, allowing you to develop PL/SQL web applications using the PL/SQL Web Toolkit (OWA) and Oracle Application Express (Apex), and serve the content using the Express web framework for Node.js.

    Please feel free to try and suggest any improvements. Your thoughts and ideas are most welcome.

    Release History

    See the changelog.

    Installation

    Prerequisites

    There are several prerequisites needed to both compile and run the Oracle database driver. Please visit the node-oracledb INSTALL.md page for more information. On where Oracle is looking for the client consult: https://oracle.github.io/node-oracledb/doc/api.html#oracleclientloading

    Installing

    • Create and move to a new directory
    • Create a new npm project (npm init)
    • Install package (npm install web_plsql)
    • Install the PL/SQL examples (sqlplus node_modules/web_plsql/examples/sql/install.sql)
    • Start the sample server (node node_modules/web_plsql/examples/sample)
    • Invoke a browser and open the page http://localhost:8000/base

    Configuration

    How does a mod_plsql DAD configuration compare to the web_plsql app

    <Location /pls/sample>
      SetHandler                    pls_handler
      Order                         deny,allow
      Allow                         from all
      PlsqlDatabaseUsername         sample
      PlsqlDatabasePassword         sample
      PlsqlDatabaseConnectString    ORCL
      PlsqlAuthenticationMode       Basic
      PlsqlDefaultPage              sample.pageindex
      PlsqlDocumentTablename        doctable
      PlsqlErrorStyle               DebugStyle
      PlsqlNlsLanguage              AMERICAN_AMERICA.UTF8
    </Location>
    
    const fs = require('fs');
    const path = require('path');
    const express = require('express');
    const bodyParser = require('body-parser');
    const multipart = require('connect-multiparty');
    const cookieParser = require('cookie-parser');
    const compression = require('compression');
    const morgan = require('morgan');
    
    const oracledb = require('oracledb');
    const webplsql = require('../lib');
    
    /*
    *	Allocate the Oracle database pool
    */
    
    const databasePool = oracledb.createPool({
    	user: 'sample',
    	password: 'sample',
    	connectString: 'ORCL',
    	poolMin: 10,
    	poolMax: 1000,
    	poolIncrement: 10,
    	queueRequests: false,
    	queueTimeout: 1000
    });
    
    databasePool.catch(e => {
    	console.error(`Unable to create database pool.\n${e.message}`);
    	process.exit(1);
    });
    
    /*
    *	Start the server
    */
    
    const PORT = 8000;
    const PATH = '/pls/sample';
    const OPTIONS = {
    	defaultPage: 'sample.pageIndex',
      doctable: 'docTable',
      errorStyle: 'debug'
    };
    
    // create express app
    const app = express();
    
    // add middleware
    app.use(multipart());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({extended: true}));
    app.use(cookieParser());
    app.use(compression());
    app.use(morgan('combined', {stream: fs.createWriteStream(path.join(process.cwd(), 'access.log'), {flags: 'a'})}));
    
    // add the oracle pl/sql express middleware
    app.use(PATH + '/:name?', webplsql(databasePool, OPTIONS));
    
    // serving static files
    app.use('/static', express.static(path.join(process.cwd(), 'examples/static')));
    
    // listen on port
    console.log(`Waiting on http://localhost:${PORT}${PATH}`);
    app.listen(PORT);

    Missing features

    Features in mod_plsql that are not (yet) available in web_plsql:

    • Support for APEX 5.
    • Default exclusion list.
    • Basic and custom authentication methods, based on the OWA_SEC package and custom packages.

    Supported mod_plsql configuration options:

    • PlsqlDatabaseConnectString -> specified when creating the oracledb connection pool
    • PlsqlDatabaseUserName -> specified when creating the oracledb connection pool
    • PlsqlDatabasePassword -> specified when creating the oracledb connection pool
    • PlsqlDefaultPage -> use the "doctable" configuration option
    • PlsqlDocumentTablename -> use the "defaultPage" configuration option
    • PlsqlErrorStyle -> use the "errorStyle" configuration option
    • PlsqlLogEnable -> use a HTTP request logger middleware for node.js like morgan
    • PlsqlLogDirectory -> use a HTTP request logger middleware for node.js like morgan
    • PlsqlPathAlias -> use the "pathAlias.alias" configuration option
    • PlsqlPathAliasProcedure -> use the "pathAlias.procedure" configuration option

    Configuration options that are not (yet) supported:

    • PlsqlIdleSessionCleanupInterval
    • PlsqlAfterProcedure
    • PlsqlAlwaysDescribeProcedure
    • PlsqlBeforeProcedure
    • PlsqlCGIEnvironmentList
    • PlsqlDocumentPath
    • PlsqlDocumentProcedure
    • PlsqlExclusionList
    • PlsqlRequestValidationFunction
    • PlsqlSessionCookieName
    • PlsqlSessionStateManagement
    • PlsqlTransferMode

    License

    MIT

    Install

    npm i web_plsql

    DownloadsWeekly Downloads

    11

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    114 kB

    Total Files

    41

    Last publish

    Collaborators

    • doberkofler