FCC Speedrun 2 — File Metadata Microservice
If you don’t know what FCC Speedrun is — here is a link to a GitHub repo.
In Go you have defined folder structure to organize your code and while learning you better stick to it or else you’ll spend a ton of time figuring out the errors thrown at you by the build tool.
Another thing is that there is a strict styleguide — no more deciding where to put the opening curly brace or how much space to use for indentation. Also Go has a built-in tool to format your code according to the styleguide.
This project is pretty simple — the server-side code serves the
html template with a simple form which is used to upload a file to the server. On the server the form data gets parsed, file is stored in the memory and the file info could be retrieved from the memory. This part was a bit tricky so I went with saving the file to the disk, getting the file size and then deleting the file— I’m pretty sure this isn’t the most effective solution and that part of the code has to be refactored.
For the live version I’m using Heroku. Only gotcha here was how you set the port for you server from Heroku env:
Thank you for your attention and happy coding 🤓.