We’re going to have a file structure that consists of a public directory where we keep styles, images, etc and then our views directory which is the standard for the Pug template files. Var express = require ( ' express ' ) var app = express () Let’s get coding by creating the index.js file. ![]() ![]() We’ll be using Express and Pug, so let’s install those now.Gosh this project was fun! The Express app:įirst off, I created a new project and initialized npm It’s super cool that we get to work with these new ways of doing things and set up servers on AWS. As we have several web properties at NaturalPoint it’s really the perfect proof of concept. I made this for the company I work at, NaturalPoint, so I’m going to use their site as an example. Here’s an example repository to see this in action: /peterramsing/Maintenance-Site Here’s what I did: ![]() I decided on a very simple Express server paired with Pug (formerly Jade) and then went with AWS for the cloud service (I’ll discuss AWS in a future post). It also didn’t have a good catch-all method. ![]() My first pass was to use a virtual host but it was a bit messy and caused for a lot of very WET coding. How about if you have multiple sites that you have to take down and you want there to be a “we are down right now” but branded for each domain? This was the dilemma that I had to solve and I must say, I like what I came up with. If you’ve ever had to create a maintenance page for your website when you need to do some server work or some larger database operation that will need your system offline, you’ve probably suffered a headache about how to do it well. Setting up a maintenance site for multi-domain routing. Creating a Maintenance Site with Express and Pug
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |