Advertisement
KanjiCoder

server-js-part-18

Jun 18th, 2022 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  2. WWW.TINYURL.COM/BOMB-GAME-TUTORIAL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GO THERE !!!!
  3. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4.  
  5. const LIB_URL = require( "url" );
  6. const LIB_Q_S = require( "node:querystring" );
  7.  
  8. require( "http" ).createServer( function( i_ask , i_giv ){
  9.  
  10.     var sob ={
  11.       m_ask : i_ask                                  //!@ask@!//
  12.     , m_giv : i_giv                                  //!@giv@!//
  13.     , m_url : LIB_URL.parse( i_ask.url , 1 ).pathname//!@url@!//
  14.     , m_pam : LIB_Q_S.parse( i_ask.url , 1 ).query   //!@pam@!//
  15.     , m_seg : [ "URLPATH_SEGMENTS_NOT_LOADED]" ]     //!@seg@!//
  16.     };;
  17.  
  18.     sob.m_url = sob.m_url.toUpperCase();             //!#MRI#!//
  19.  
  20.     i_giv.end( sob.m_url );
  21.  
  22. }).listen(process.env.PORT);
  23.  
  24. /** CHANGE_HISTORY ***************************************** ***
  25.  
  26.     TUTORIAL PART 018 : https://pastebin.com/ZCFNxebJ
  27.                       : tinyurl.com/SERVER-JS-PART-18
  28.                       : git@github.com:KanjiCoder/AIM_018.git
  29.                       : https://github.com/KanjiCoder/AIM_018
  30.  
  31. *** ***************************************** CHANGE_HISTORY **/
  32. /** PREFIXES *********************************************** ***
  33.    
  34.     LIB_  : any library we got by using require function
  35.     m_    : member variable prefix.
  36.     i_    : formal parameter argument ( i == input )
  37.  
  38. *** ******************************************************** **/
  39. /** COMMENTS_ARE_READ_LAST_OR_NEVER ************************ ***
  40.  
  41.     @LIB_URL@ : LIBRARY : Universal Resource Locator
  42.     @LIB_Q_S@ : LIBRARY : QueryString
  43.  
  44.     @sob@ : State Object Bundle
  45.     @ask@ : What client is asking for ( request  / req )
  46.     @giv@ : What server is giving  us ( response / res )
  47.     @url@ : /URL/NOT/INCLUDING/ROOT/DOMAIN
  48.     @pam@ : query parameters dictionary
  49.     @seg@ : @url@ parts packed into an array
  50.  
  51.     #MRI# : Make Routing ( case ) Insensitive
  52.  
  53. *** ******************************************************** **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement