Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is possible to pass in parameters to an alias which you have defined under initialModules in your Profound.js config configuration file.js

Code Block
module.exports = {
  "port": 8081,
  "staticFilesDirectory": "htdocs",
  "pathlist": [
  "initialModules": {
    "/hello": "pjssamples/hello",
    "/hello2": "pjssamples/hello2",
    "/connect4": "pjssamples/connect4"
  "dbDriver": "IBMi",
  "timeout": 3600


Instead, let's make it so we can pass the 'turncolor' in as a variable. To do this, we need to will add a parameter to both the connect4 and initialize and the initialize function - , as well as adding the logic to handle the parameter:

Code Block
//New parameter for entry function
function connect4(firstturn) {
  //New parameter for initialize function
  function initialize(firstturn) {
    //Checks if 'firstturn' is either "red" or "yellow"
    if (firstturn != null && ["red", "yellow"].indexOf(firstturn) >= 0) {
      turncolor = firstturn;
    } else {
      turncolor = (Math.random() > 0.5 ? "yellow" : "red");

This means we can still call our connect4.js example normally, but in addition, we can also pass in a parameter toocall it with a parameter. Both of the following alias URL's are valid:


  1. http://localhost:8081/myprogram?username=Profound LogicProfoundLogic&
  2. http://localhost:8081/myprogram?p1=Profound LogicProfoundLogic&

An invalid way might be: