Intro to Phoenix: Running our Phoenix Project

Phoenix Elixir

English (Auto-generated)

Hello friends. Now that we've generated our project, let's actually explore it a little bit more and get it to actually run in the browser. So last time, if you recall we ran this command me mix phoenix, f p h x dot neu. And then the project was generated. This holder structure with a lot of files and folders within it. Now, one thing I didn't run at the end is that it actually asked me to fetch and install dependencies, which I didn't say anything here. So you could simply put y in this case which will run a mix um task that is depth dot get okay what depths dot get? It will actually fetch all the dependencies for our phoenix project. So while this is happening here and I'll show you how you will do it later if you click on this mix, that the excess, if you recall the xs are electric files that are meant to be scripts meaning they don't get compiled but you could actually run them. So in our particular case, um when for example you want to run, we want to fetch the dependencies, it'll actually look at this mixed excess. It's gonna find this depth um function that is going to run when you run mixed depths dot get, which is exactly what it's running at the moment. So right now you will see it's actually automatically loading a lot of libraries right here. So the phoenix library, of course this is we're running phoenix. So that's usually the library at the top and then you see a bunch of other ones that we're going to explore. So just to give you an idea the ecto is the library that we use to connect to the database. And um for instance sequel is basically for us to use sequel with an Ecto, it defaults to using a sequel database. We're going to be using Postgres which is kind of the default for a lot of applications. Again, if you want to use something like Mongo or some other types of library, you could install the dependency there and so on. Generally it comes in with all these libraries dependencies installed. So if you change it here, let's say you want to change photographs to a library that supports Mongo, you simply run mix depth stopgaps. Once you alter this right here you get you can run mixed depths that gap and that will install the dependencies for you. Now notice here again, just more as a refresher for you if you've done an elixir of course or you've done the series before, so noticed this is a list of two poles. Okay, a list of two poles. And then each tuple has two elements. The first one is an atom and then the second one is a string. So the first one is the dependency name, the library name and then the second one is the version of it. Um you may be familiar with this versioning um format. So the one that is least obvious is probably the still decorators that what this really means is it will accept anything with the last digit in this case. So let's say in this case it's the six in this case would be the four. So it will accept basically anything that is six or more as the last digit of this dependencies version. So in this case to accept 1.6 point 6.6 point seven and so on, it doesn't have to be a single digit, it could be 1.6 point 11 point 23 and so on. But the idea is this usually for the last digit is a is a patch or or or it is a minor version change. That's why you you know in many cases you will not see it like a greater than one. In some cases you could see something like this but in most cases you will see something along along these lines. Um
29 Views 0 Likes 0 Comments

We learn about fetching dependencies and running our Phoenix project.

Leave a comment (supports markdown format)