npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

noradle-http

v0.13.2

Published

noradle http gateway for plsql servlet

Downloads

10

Readme

APIs

  • create a DBPool instance
  • embed noradle.handlerHTTP for a node http server
  • join static with expressjs
  • use with experssjs(static) / harp / socket.io example

create a DBPool instance

var DBDriver = require('noradle-nodejs-client').DBDriver;
var dbPool = DBDriver.connect([port, host], {cid : 'client_identifier', passwd : 'password for the client'})
  • [port,host] is the same parameters as net.connect API
  • 2nd parameter is cid:passwd, to allow noradle dispatcher to accept connection

noradle.HTTP for a node http server

var httpHandler = require('noradle-http')(dbPool, customizedReqBase, configOptions)
  • dbPool is created by require('noradle-nodejs-client').DBDriver.connect
  • customizedReqBase is a constructor function who can set name-value pairs to send to oracle, like internal ReqBase
  • configOptions is customized configuration object that set or override default options, all available cfg is here
  • what require('noradle-http') return is just a normal node http handler like function(request, response){...}

join static with express

  • noradle doesn't support static file service
  • you can use express's static module or any static service module
  • you can use express or other node http server module to set route to noradle servlet and static module, combine them in one http server
...
var express = require('express')
  , app = express()
  ;

app.use('/staticMountPoint/', express.static('/some-mount-point-for-static-files/noradle-demo/static'));
app.use(require('noradle-http')(...));
app.listen(1520);

examples

a servlet only http server

  • only dynamic plsql servlet server, without static file service
  • use node's internal http module only, no express included
  • no customized ReqBase
  • use default configuration for noradle.HTTP
var DBDriver = require('noradle-nodejs-client').DBDriver
  , dbPool = DBDriver.connect([8019, 'qhtapp1'], {cid : 'demo', passwd : 'demo'})
  , pspHandler = require('noradle-http')(dbPool)
  , http = require('http')
  ;
http.createServer(pspHandler).listen(1520);

a servlet only http server with customized ReqBase

  • in customized ReqBase(a constructor function), set this.name to create or replace name-value pair that's about to send into oracle
  • some name like "x$xxx" have special meaning, that control the servlet processing behavior, see oraReq-control-headers
function myReqBase(req, cfg){
  // set some name-value pair to oracle, in plsql, r.getc('name1') will get 'value1'
  this.name1 = 'value1';
  // map all request to plsql procedure "basic_io_b.req.info"
  this.x$prog = 'basic_io_b.req_info';
}
var DBDriver = require('noradle-nodejs-client').DBDriver
  , dbPool = DBDriver.connect([8019, 'qhtapp1'], {cid : 'demo', passwd : 'demo'})
  , pspHandler = require('noradle-http')(dbPool, myReqBase)
  , http = require('http')
  ;
http.createServer(pspHandler).listen(1520);

a servlet only http server with customized config

  • you can provide none-default configuration (a object type) for noradle.HTTP
var DBDriver = require('noradle-nodejs-client').DBDriver
  , dbPool = DBDriver.connect([8019, 'qhtapp1'], {cid : 'demo', passwd : 'demo'})
  , pspHandler = require('noradle-http')(dbPool, {
    static_url : 'http://noradle-demo.some-static-cdn.com',
    upload_dir : __dirname + '/upload'
  })
  , http = require('http')
  ;
http.createServer(pspHandler).listen(1520);

a servlet and static server using express

  • mount static handler for "/demo1/" first, avoid go through noradle.HTTP handler for every static request
  • in "myReqBase", tell noradle the base url for static url reference is "/demo1/"
var staticMountPoint = '/demo1/';

function myReqBase(req, cfg){
  this.y$static = staticMountPoint;
}

var DBDriver = require('noradle-nodejs-client').DBDriver
  , dbPool = DBDriver.connect([8019, 'qhtapp1'], {cid : 'demo', passwd : 'demo'})
  , pspHandler = require('noradle-http')(dbPool, myReqBase)
  , express = require('express')
  , app = express()
  ;

app.use(staticMountPoint, express.static('/Users/cuccpkfs/dev/project/noradle-demo/static'));
app.use(pspHandler);
app.listen(1520);