The Simplest Tech Stack

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you are like me you must be sick and tired of all the BS in the web dev space after years of doing it with all its front end Frameworks backend options styling Solutions and rendering strategies it really is hard to stay up to date in this world this becomes even more frustrating when you want to remove all the background noise and simply build stuff so in this video we'll do just that we'll remove all the unnecessary complexity and build a scalable state-of-the-art app using a minimalist Tex stack we'll use the ghost standard library on the back end to capture incoming HTTP requests handle our business logic and return HTML to the client then in the response we load up HDMX and then easily trigger aing requests for a great user experience on the front end that's it really this is the entire stack and by the end of this video you'll be amazed by how simple yet powerful this actually is after all this app is HTML first server rendered Network efficient thanks to the lightweight hmx and scalable thanks to the power of go without further Ado let's make sure go is installed on your machine machine and then initialize our project for future reference we'll execute our code using the go run command which accepts one or more go files as the target most of our backend code will be placed in main.go and I'm storing the HTML files under templates of course our app needs some styling so I'm going to Define an index. CSS file under the static directory in the main.go file let's import the template module to compute our HTML logging and the HTTP module to handle HTTP requests and responses next in the main function we'll make sure that any call to static assets will be correctly resolved to our static directory this is how the server will know how to resolve requests to images or css files then when a user makes a call to the root path we'll use the template module to retrieve a file from the disk compile it and send it as the response finally we call the listen and serve HTTP method and we have our HTTP server running by the way a few weeks back I posted a video showcasing a similar stack but with go fiber as the HTTP engine just like Java developers hate it when you don't use in our factories go developers hate it when you don't use the standard Library so we'll just stick with the basics in this video which as any go developer will enjoy pointing out is more than enough back to the code our root path is resolved to a template /index HTML file so let's go ahead and create it the app will allow users to search for various companies look through the results and then add the relevant results to a favorites list since HDMX is also present in the page we can augment the default input Behavior so that whenever the key up or change events are triggered and a snle request to the search endpoint will be sent to the server then when the response is received the HTML will be placed inside the search results container back in the main.go file let's add a new Handler for the search endpoint this time we'll compute the HTML based on the results fragment and the response received from the third party polygoni API quick side note I'm handling all the third party API integration in a separate stock.go file where I'm defining a couple of structs and then simply performing HTTP calls to polygon the resulting Json is on Mar into our own data structures all via the GH standard Library back to our search Handler the key is received as a query parameter and the obtained data is used to compute the results HTML this HTML page is just a fragment which will be placed inside the main index.html file as I mentioned the second ago here we'll iterate over the results display the company name and then render an add button this one triggers a post request with the stock endpoint and Depends the resulting content at the end of the stock list element as for the Handler let's make sure we are pressing the correct request method retrieve the ticker from the request body and then only compute the stock element block inside the index.html file FYI this is where You' probably want to store the information in the database and maybe add some other rest methods like put or delete now we can start the server and see the application in action pretty neat right if you found this video useful you'll probably like some of the other videos on my Channel please like subscribe and until next time thank you for watching
Info
Channel: Awesome
Views: 103,149
Rating: undefined out of 5
Keywords:
Id: Qi9A6-xoOkA
Channel Id: undefined
Length: 3min 55sec (235 seconds)
Published: Thu Oct 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.