web_plsql
0.5.0
该快速中间件是在Oracle数据库中运行的PL/SQL应用程序与Node.js的Express Web服务器之间的桥梁。它是MOD_PLSQL,嵌入式PL/SQL网关和ORD的开源替代方案,可让您使用PL/SQL Web Toolkit(OWA)(OWA)和Oracle Application Express(APEX)开发PL/SQL Web应用程序,并使用Node.js. J.J. J.J.
请随时尝试提出任何改进。您的想法和想法是最欢迎的。
请参阅Changelog。
编译和运行Oracle数据库驱动程序需要几个先决条件。请访问node-oracledB install.md页面以获取更多信息。关于Oracle在哪里寻找客户咨询:https://oracle.github.io/node-oracledb/doc/api.html#oracleclecleclientloading
npm init )npm install web_plsql )sqlplus node_modules/web_plsql/examples/sql/install.sql )node node_modules/web_plsql/examples/sample )http://localhost:8000/base <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 ) ;麻省理工学院