Building pugia.com ~ Let’s start again
When I started the project 20lines a friend told me that I should have used a framework to build it, my reply at the time was that “I wanted to have control over everything”. With hindsight I can say that he was right, if you don’t have any particular technologic reason, it’s always better to rely on a consolidated framework, it would have saved me a lot of time, (thanks anyway Luca).
On the other hand, in my opinion using a framework remove a lot of fun, and since with this website I just want to have fun, I’ll try to use them as little as possible. Obviously this website is not a big project but I’d like to develop it as it will be.
Since three years Pugia.com is no more hosted on a classic hosting service, it was on the smallest instance possible of AWS EC2. Last time I logged in the console I saw this new service from Amazon called Lighsail that basically simplify the deploy of virtual machines. Since the first year is free I decided to give it a try.
So I started the smallest instance, with Ubuntu 16.04 on it and proceed to install Node.js with Nginx as reverse proxy, make it run as a service using pm2 and I also added the support to https with let’s encrypt. I followed these great tutorials of DigitalOcean:
Once the server was up and running, I created the simplest possible HTML home page and served with the node server as a static asset:
// dependencies
const express = require('express');
const app = express();
// variables
const PORT = 3000;
// routing
app.use('/public', express.static(__dirname + '/public'))// start server
app.listen(PORT, function () {
console.log('%d listening on %d', process.pid, PORT);
});
The first test you can do on a website is the PageSpeed test by Google, it analyze the page and give you a score from 0 to 100. I want to keep my site as close as possible to the 100/100.
In my current design I don’t have any image or css asset (thanks Perry), only static html page so if I run the PageSpeed I got a great 100/100!! 🎉
That was easy! Pugia out… #micdrop