Who Am I?

Myself
My name is Alex and I live in Sydney NSW (Australia). I created this site to host a collection of web applications I developed over time. I have created a new web framework to assist with rich web application development and currently in the process of developing applications and demos to showcase the framework in action. My contact information is below.

Email Address:
alexwait@bigpond.net.au

Phone (International):
+61 2 419 445 955
Javaika

Localhost Starter Kit

This guide walks developers through running Javaika Frameworks locally on their machine - with HTTPS support, ideal for your free-tier access tokens; for this guide we will use PowerShell for all operations.

1. Install Node.js

1. Go to https://nodejs.org

2. Download the LTS (Long-Term Support) version for your Operating System (OS).

3. Run the installer and ensure the "Add to PATH" option is checked.

4. Once installed, open PowerShell and verify installation of Node and Node Package Manager (NPM):

node -v
npm -v

2. Create Your Local Project Folder

Create a working folder anywhere, e.g.:

Windows

mkdir C:\javaika-localhost
cd C:\javaika-localhost

Mac/Linux

mkdir ~/javaika-localhost
cd ~/javaika-localhost

3. Install Express

Within the 'javaika-localhost' directory in PowerShell, run the following command to install Express.

npm install express

At this point you shoud observe the following files and folders under the 'javaika-localhost' folder.

1. package-lock.json file (created when installing Node dependencies (i.e. Express)

2. node_modules folder (where Node dependencies are installed)

4. Create Project Files

Inside the 'javaika-localhost' folder, create the following files:

1. index.html

javaika-localhost/public/index.html  # Your local webpage


            
               <!DOCTYPE html>

               <html lang = "en-AU">
    
                  <head>
      
                     <title>Localhost Example</title>
    
    
                     <meta name = "description" content = "Demo of running localhost.">

                     <meta name = "viewport" content = "width=device-width, user-scalable=yes">

                     <meta name = "keywords" content = "localhost demo">


                     <meta http-equiv = "Content-Type" content = "text/html;charset=UTF-8">
    
                  </head>


                  <body>
    
                     <h1>Hello Localhost!</h1>
  
                  </body>
  
               </html>
            
            

2. http-server.js

javaika-localhost/http-server.js  # Standard local server


            
               const express = require('express');
               
               const path = require('path');


               const app = express();

               const PORT = 8080;

 
               // Serve static files (HTML, JS, CSS) from the "public" folder
               
               app.use(express.static(path.join(__dirname, 'public')));


               // Parse JSON bodies (for POST requests)

               app.use(express.json());


               // Start the server
               
               app.listen(PORT, () => {
 
                 console.log(`Local server running on http://localhost:${PORT}`);

               });
            
            

3. package-json

javaika-localhost/package.json


            
               {
                  "name": "javaika-localhost",
                  
                  "version": "1.0.0",
                  
                  "description": "Some description",
                  
                  "main": "index.js",
                  
                  
                  "scripts":
                  {
                     "test": "echo \"Error: no test specified\" && exit 1"
                  },
                  
                  "keywords": [],
                  
                  "author": "Some author",
                  
                  "license": "ISC",
                  
                  "type": "commonjs",
                  
                  
                  "devDependencies":
                  {
                     "http-server": "^14.1.1"
                  },
                  
                  "dependencies":
                  {
                     "express": "^5.1.0"
                  }
               }
            
            

5. Setup Secure Localhost (optional but highly recommended)

1. Inside the 'javaika-localhost' folder, create https-server.js

javaika-localhost/https-server.js  # Secure local server


            
               const https = require('https');
               
               const fs = require('fs');
               
               
               const express = require('express');

               const app = express();


               // Serve static files (your local project)
               
               app.use(express.static('public'));


               // HTTPS credentials
               
               const options = {
               
                  key: fs.readFileSync('key.pem'),
                  
                  cert: fs.readFileSync('cert.pem')
               };


               // Start HTTPS server
               
               https.createServer(options, app).listen(8443, () => {
               
                  console.log('HTTPS localhost running on https://localhost:8443');
               });
            
            

2. Install Chocolatey by running the following commands in order:


                
               Set-ExecutionPolicy Bypass -Scope Process -Force
                
            

                
               [System.Net.ServicePointManager]::SecurityProtocol = 
               
               [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
                
            

            
               iex((New-Object System.Net.WebClient).DownloadString
               
               ('https://community.chocolatey.org/install.ps1'))
                
            

3. Install mkcert inside Chocolatey

choco install mkcert -y

4. Install the local certificate authority (CA)

mkcert -install

5. Generate certificates for localhost

mkcert localhost 127.0.0.1 ::1

This creates two files in the current directory:

1. localhost.pem (the certificate) - rename this to cert.pem

2. localhost-key.pem (the private key) - rename this to key.pem

6. Run the localhost server and verify the connection

node http-server.js
node https-server.js

Your localhost server should now be available at 'http://localhost:8080'

For secure localhost it will be available at 'https://localhost:8443'