Now, we need to import server from server.js and startServer from functions.js into index.js
and actually start a server!
You can start it on any free port, but I suggest using port 8080 for us to be on the same page...
Let鈥檚 add our first route to the server to be able to test it.
In server.js, right below the comment add the GET /check route.
The payload served on this route should be { version: '0....
Follow up with creating the object that we will serve as a config to our Mining Empire app
Create the file constants.js and export the object CONFIG from it
You can take a look at the example on https://v2....
Now that we have the CONFIG constant, we can import it into server.js and add a new route
GET /config that will serve it.
Implement this route and make sure it works by going to http://localhost:8080/config in the browser...
Awesome! We have the config and we can access it!
Now, let鈥檚 make it functional.
The easy way would be to copy and tweak the structure from https://v2.coderslang.com/evil-empire-config
A bit harder approach is to write everything yourself....
Good job! Now we move on to describing the upgrades.
Upgrades is an array of objects. Each upgrade improves the performance of one or more producers.
Here鈥檚 the structure of a single upgrade:...
The upgrades are done, so let鈥檚 add the achievements that the user can unlock within the game.
Once again, we need an array of objects:
id: a unique number which is used to identify an achievement title: a string that sets the name of the achievement description: a string that describes the achievement pictureURL: a string, an https link to the achievement picture in ....
Our mining empire should be playable for the extended periods of time, so let鈥檚 add prestige levels.
prestigeLevels is an array of objects:
id: a unique number which is used to identify the prestige level title: a string that sets the name of the prestige level multiplier: a number that defines increased production on this prestige level pictureURL: a string, an https link to the prestige level picture in ....
Fix the function printUserCount.
Right now it prints to the console the string Promise { <pending> }, but it should print the number of users.
This task is part of the Full-Stack JavaScript Course...
Fix the function printUserCount.
It should call handleUnknownError if the Promise is rejected.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post...