web_plsql
0.5.0
이 Express Middleware는 Oracle 데이터베이스에서 실행되는 PL/SQL 응용 프로그램과 Node.js의 Express 웹 서버 간의 브리지입니다. MOD_PLSQL, 임베디드 PL/SQL 게이트웨이 및 ORD에 대한 오픈 소스 대안으로 PL/SQL 웹 툴킷 (OWA) 및 Oracle Application Express (APEX)를 사용하여 PL/SQL 웹 응용 프로그램을 개발할 수 있으며 Node.js의 Express Web Framework를 사용하여 컨텐츠를 제공합니다.
자유롭게 시도하고 개선을 제안하십시오. 당신의 생각과 아이디어가 가장 환영합니다.
Changelog를 참조하십시오.
Oracle 데이터베이스 드라이버를 컴파일하고 실행하는 데 필요한 몇 가지 전제 조건이 있습니다. 자세한 내용은 Node-Oracledb Install.md 페이지를 방문하십시오. Oracle이 클라이언트를 찾고있는 곳에서 https://oracle.github.io/node-oracledb/doc/api.html#oracleclientloading
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 ) ;MIT