Skip to content

Latest commit

 

History

History
79 lines (48 loc) · 2.89 KB

setup.md

File metadata and controls

79 lines (48 loc) · 2.89 KB

Setup for contributing to Toronto JS Blog

Pre-requisites

  • Node.js - The JavaScript runtime that runs the project
  • npm - To run the commands and install the dependencies
  • volta - (OPTIONAL) to manage Node.js versions
  • mkcert - To generate SSL certificates for local development

Getting Started

(OPTIONAL) Install volta

volta is a tool to manage Node.js versions. It's optional, but it's a good tool to have if you work with multiple Node.js projects. You can skip this step if you want to use your system's Node.js version and don't mind about node versions. With volta, you don't need to install node.js separately as it will keep track of the versions for you.

To install volta on Linux or Mac, run the following command:

curl https://get.volta.sh | bash

On Windows, you can run the following command:

winget install --id Volta.Volta

After installing, you will need to restart your terminal or open a new terminal window to use volta.

Now, when you run the project, volta will automatically install the correct version of Node.js for the project.

Install mkcert

You will need to generate a certificate to run the local server. To do so, you can use mkcert.

First, install mkcert for your operating system, following the instructions on the mkcert GitHub page. On Windows 10+ you can use winget instead with the command below:

winget install --id FiloSottile.mkcert

After installing mkcert, you will need to restart your terminal or open a new terminal window to use mkcert.

Install root certificate

Run the following command to install the root certificate:

mkcert -install

This will add a new root certificate to your system's trust store. That will make your system trust any certificate generated by mkcert and allow you to run a local server with HTTPS.

Generate a certificate for localhost

To generate a certificate for localhost, inside the root project folder, create the certs folder and run the following command:

mkdir certs

Then run the following command to generate the certificate for localhost:

mkcert -key-file certs/server.key -cert-file certs/server.crt localhost

This will generate a server.key and server.crt file in a certs directory at the root of the project.

Start the local server

Once you have the certificate, you can start the local server by running the following command:

npm start

This will start the local server at https://localhost:3000/. You can then access the site from your browser.