Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Monday, November 22, 2021

Hosting a website on your local computer

If you want to host your website on your local Windows PC, you have to run a local web server:

  1. Setup IIS (it comes with Windows 10+). Use a port other than 80. Copy your website files to the folder that IIS recognizes. 
  2. Verify that on your browser, you can see your website when you type localhost:<Port> to the address bar.
  3. Add port to Windows Defender Firewall inbound rules.
  4. Add port to your modem so that the modem forwards traffic on that port to your local IP address. On my modem it is done in NAT Forwarding - Virtual Servers
  5. Verify that your website is online by turning off wifi on your mobile phone and typing http://<your global IP>:<Port> into your mobile browser address bar.
You cannot use https without a domain name for your local website because "In order to get a certificate for your website’s domain from Let’s Encrypt, you have to demonstrate control over the domain", i.e. you have to attach your IP address to a domain name.
Links related to SSL certificate:

Tuesday, October 09, 2018

Simple login demo with NodeJS

I wrote a simple / bare bones login demo with NodeJS. It uses cookies to remember the user. Note that this is the absolute minimum and should not be used in applications requiring security.

Note that in login.html we have to use HTTP POST (not GET. This line in login.html: form action="/login" method="post) so that user name and pass is not displayed in browser address bar!

Thursday, November 24, 2016

Converting a desktop game to a web app

Two years ago, I wrote a simple desktop game, Save My Cheese, mainly to explore the A* pathfinding algorithm. In the game you are trying to block the path of mice by puzzle pieces and prevent the mice from reaching the cheese. When you finish the puzzle before the mice reach the cheese, you finish that level.