
Lesson Description
The "Course Project Review" Lesson is part of the full, Build a Fullstack App with Vanilla JS and Go course featured in this preview video. Here's what you'd learn in this lesson:
Maximiliano provides an overview of the course project so far, highlighting components like app.js for client-side interaction, API.js for backend requests, main.go for server setup, handlers for HTTP requests, and models and repositories for database interactions.
Transcript from the "Course Project Review" Lesson
[00:00:00]
>> Maximiliano Firtman: So, we are half of our project. So, let's make a review, it's a good time to make a review of what we have so far. So, let's start with the client side. So, client side, we have app.js, so that's our JavaScript file that actually it's acting as our connection to the UI.
[00:00:20]
So, or example, from the HTML, we are calling app dot something at some point, app.search, for example, in our search box. Then we have one service so far, it's API.js. This is the one that is making the requests to the backend. So we are centralizing, making requests to the backend and maybe parsing the response at this in terms of if it's coming with an HTTP 200, meaning that it's okay.
[00:00:49]
Or if there is an error, we are going to handle that directly in API changes, we are centralizing that there. Then we have a couple of components. So far, we have only one, but the idea is that we will have components in the components folder. Remember, each web component is at least one class in JavaScript, and we are creating one JavaScript file per component, by the way, that's not mandatory.
[00:01:13]
In JavaScript, you can just put all the components in one file and it will just work. Server side, we have our main.go, that in this case is the entry point of our app and it's also where we are setting up our server. So there we are, for example, connecting to the database, reading the .m file with the connection string.
[00:01:38]
We are setting up everything, including setting up the handlers. So we're also creating a logger that is just a utility that we have to store in a file every problem that we may have. Remember, in the future, we can replace that, we can change that with a logger that connects to a cloud-based service.
[00:01:59]
That there are many, and different cloud services that are offering login systems, or we can use a database. Also, we have handlers so far also we have only one. It's the handler for movies. In this case, this is gonna handle the HTTP request. And this is the one that is reading the request.
[00:02:18]
And based on the request and the route is actually sending something back to the client, and the handler is not the one making requests to the database. The handler for that is communicating with actually a model repository that uses a model. So that's why we have a model or several models, basically per entity.
[00:02:42]
So we have users that we haven't used them so far. We have movies, we have genre, and we have actor. And then, the repository, actually right now in the data package, are the one that is actually making the query to the database and sending the data back. In the form of a model or a collection of models and a slice of model, talking about go vocabulary.
[00:03:06]
And you're sending that back to a handler most of the time, and the handler is sending that back in JSON to the client that is actually been taken by the API. And maybe the API is sending that back to the app to whoever was asking for that content, okay?
[00:03:24]
Remember, this is the structure that we have so far. The only thing that we are missing, that we will do in a few minutes, is the router to actually manage different routes client side. But the rest, at least all the pieces are actually there in our code.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops