Skip to content

Commit

Permalink
Merge pull request jamespeeler#15 from jamespeeler/compatibility-update
Browse files Browse the repository at this point in the history
add compatibility for all versions of Node
  • Loading branch information
jamespeeler committed May 30, 2022
2 parents 99b599a + 7b02da9 commit 2f12b1c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ const fs = require('fs')
const url = require('url');
const querystring = require('querystring');
const figlet = require('figlet')
const fetch = require('node-fetch');

//This conditional checks to see if the installed version of Node is older than version 18,
//and defines 'fetch' if the installed version is older. This is because 'fetch' was introduced as a default
//module in Node 18 (on April 19, 2022), so if you try to define 'fetch' in v18 or above, it will break the code.
if (Number(process.version.substring(1,3)) < 18){
const fetch = require('node-fetch');
}




Expand Down

0 comments on commit 2f12b1c

Please sign in to comment.