Using your postman you can experiment with the endpoints and set the API in the headers with api-key in key and the value being set to your DEV API.
I am in a hurry to see the project live!
If you clone the repo and try to run it should report Invalid value "undefined" for header "api-key" this means the .env file isn't created yet, use the template below.
ENV Variables for .env file.
DEV_USERNAME = username
DEV_API_KEY = supersecretkey #obtained via https://dev.to/settings/account
PER_PAGE = 10 #if you like pagination
COMMENTS = true #if you want comments in each post
SITE = https://yoursite/ #SEO/Social Share
These variables are set to generate the entire portfolio and all the fetch calls will use these variables.
Sapper's preload function can pre-render the content from the API and this is the secret sauce of the project.
Looking at the blog directory it has .js files and .svelte files, the .js files are executed on the server side and can be imported to the .svelte components(files) and the files that start with _(underscore) is private and will never be executed or be visible to the client side.
This is the code for populating the the /blog route. *Note, _posts.js acts as a backend and only the responses are available for the client app.
The magic, you see index.json.js has no _(underscore) prefixed so this means the file is visible to the client app and you can verify it by going to http://localhost:3000/blog.json and you should see the JSON response.
Now that we know the relationship of the underscore files and it's corresponding js files. We just need to execute the preload function to load data on the template.