So it's time to set up our project and we've already got a lot of work done, and I'm looking now at
what we were finished, what we last finished with when we were experiment, experimenting with sessions.
And I have all this code written and I don't want to rewrite this from scratch because this is a good
starting point for a Web application.
Things will change as time goes on, but this is absolutely a good starting point.
So what I'm going to do is I'm going to copy the source files from this project into a new project,
and I'm going to do that on a Mac and go to the finder and windows.
You go to your your file explorer, Windows Explorer.
And I know all of my files are in this hollow world folder, and that file exists right here.
That folder exists right here.
So I have two windows open.
One is looking at the existing hello world folder from the top level also inside that.
And the other one is in the same place where the whole world folder is.
And I'm going to create a new folder, which I will call bookings.
I call it something bookings works and I'm going to open that folder.
And then from here I will copy all of the files that I want to save, which is everything except for
those go mod and go some files.
So I will copy them from here to here and then I'll go back and open up that project folder.
Now I'm in Goaland.
You're probably in Visual Studio Code, but close that project in visual studio code and open a new
one.
So I'm going to just open and you'll choose open folder in visual studio code.
Of course, I will find that folder which I stored in visual studio code.
There it is.
And I'll open the folder I just created called Bookings and I'll open it now.
It'll give me errors because I didn't actually I have to go mad in it and all those things.
So let's open it up and see how it looks.
Command, web mango.
And of course there are errors they can't find config abcde.
I'm not worried about that at all.
I'll just open my terminal window and now I'm going to give this a go module's file, go mod in it.
But this time I'm going to actually use a real GitHub repository.
It doesn't exist yet.
I'm going to create that shortly.
We're probably in the next lecture, but I'm going to call this GitHub dot com teszler, which is my
username, and I'll call this bookings.
And it creates that good, good start now that that's created, I need to enable the integration and
I will say enable good models in modules integration and click OK, and you'll do a similar thing in
Visual Studio Kotal.
I think it might be smart enough you if you just quit out of it and start it back up, it'll be good.
Good.
So I've created that, but I still have errors.
Why?
Because up here, I mean, implementing or importing go course and I should be implement or importing
bookings and bookings.
Don't just copy and paste it in there.
Can't find Alex Edwards yet.
But that's OK.
It will when I run it, I'll ignore that error.
Any other areas here I need to worry about all the session cookie stuff.
Not that's it for that one.
What about middleware set based cookie.
What's that importing.
It's just hasn't imported that will when I run it, so don't worry about it.
And roots go.
Same thing.
I need to fix the imports here from go course that becomes bookings and bookings.
Those will be imported automatically I hope.
And that's it for that.
Let's try package config.
No errors in that.
Good.
Oops.
Handlers.
There is that one again here, Paiste.
Paiste.
Paced, and that should be it for that model's shouldn't be any problems in this one know and render.
Are there errors here?
There are good course gets changed to bookings and the course gets changed to bookings.
All right.
Now, let's just see what happens if I run this.
So I'm in my bookings folder in my terminal go run command web Stargirl.
Let's see if it automatically imports this.
It goes and finds those.
And I have an error and the areas could not find module, this is in rendered OK, so let's have a look
at that.
Oh, I misspelled bookings.
Try that again through the screen.
Run this.
Perfect.
The application started, so I should be able to go to my Web browser and hit that page, which I will
do, I will open the page localhost
88, and it should give me what it did last.
Good.
So now that's running.
That's great.
Now I want to commit this to a repository and I'm going to push to GitHub.
You don't have to if you don't want to, but it's always a good idea to push to get help because that
way you have two copies of your code, one locally and one on GitHub.
Now, I'm going to do that before I do it.
There are certain things I do not want to store in my repository.
There are things that I want to have locally or have to have locally.
And I can do that on a Mac by doing list L.A. to show me what is actually in this folder.
So I look at the folder over here, it appears I just have one, two, three, four or five things.
But if I actually do in L.A., you'll see I have this thing dot idea and the dot in front of it means
on a Mac, at least you can't see that folder.
And that's just stuff created by the ID I'm using.
And there's probably a similar thing for Visual Studio Code, but I don't want to bother committing
that to get.
So what I'm going to do is create a new file here at the root level of my project.
I'll create a new file and I'm going to give that the name.
And it has to start with a dot dot.
GeoEye, THG and Otari get ignored.
And inside of that, I'm going to put the name of that folder, which is the idea, and I want it to
ignore that.
And I'll probably be adding more things to this over time.
What the get ignore file does is it tells the version control system get, which I'm going to talk about
momentarily to ignore.
Don't put into the git repository things that are listed in the get ignored folder.
And I definitely don't want the IDIZ settings to be stored on my git repository because they're of no
value to anyone else.
Should I have someone else work on this?
They're going to probably user on it.
Maybe they're using visual studio code, maybe they're using the sublime text editor or whatever it
may be.
They're probably not going to want the same settings that I do.
So I'm going to ignore that.
All right.
So in a minute, we're going to actually create a repository and store things in it.
But how do we do that?
Well, first of all, you have to have good if you already have get installed, you can skip this part.
But if you don't, you need to go get it.
So you fire up your favorite Web browser and go to get dash m dot com and then click on the download
button.
And so if I go to the homepage for guitarist Kim Dotcom, I'm here and I actually want to download it.
So click on downloads and again, choose the one appropriate for your operating system.
I'm on a Mac, so I would download this.
I already have it installed, but I don't have to.
If you're on windows, go here.
If you're on Linux, go here or if you're using home homebrew on a Mac or its equivalent on Windows
install however you want once it's installed.
Come back to this course, just pause it right now and will actually set up a repository, OK.
All right, so hopefully you have get installed, I'm now going to go back to my command or my terminal
in my editor, I will clear the screen, I will make sure, I mean, the root level of my project and
I am.
And now I'm just going to type get in it and hit return and it creates an empty git repository.
Right now, I want to add everything in this directory, everything inside the bookings folder except
what is ignored by get ignored.
And I do that just by saying get add dot, which means add everything in this directory that's not specified
in the get ignore file.
It adds it and then I need to actually commit it, get commit him and then put a message in quotation
marks, initial commit.
Now what might happen when you press enter at this point you might say, oh no, I don't know who you
are.
You need to specify a name and an email address, but it will take you through the steps necessary to
do that.
And then you can actually do the commit.
At that point.
I already have my username and so forth set up, so I'll come at it and it's now everything is committed.
So if I actually clear the screen and on a Mac, at least on Windows, there's a similar command, but
I can't recall what it is.
You probably know what it is unless Darcel shows me now I have WFLA.
Now I have a new folder here called Douget and that is my local git repository.
And you don't need to push this to GitHub or BitBucket or whatever if you don't want to, but I encourage
you to do so.
It's very useful to be able to do that.
So how do I do that?
I'm going to push this to a get hub repository.
So I go back to my Web browser.
I go to just go to GitHub dot com and you'll need to create an account if you've not done so.
So you can create an account.
And I can look at my repositories.
I actually want to create a new repository, created an account on GitHub if you haven't already done
so.
And you can see I've got lots of projects on the go here right now, then when you've done that, go
to the plus side in the upper right hand corner and say New repository and I'm going to call mine bookings.
Hopefully I haven't used this name already.
Bookings is available.
Good.
So I'm going to make this a public repository.
You can make it private if you don't want people looking at it.
But I don't mind people looking at this.
In fact, I'm going to allow you to download the source code after any given lecture by coming to my
GitHub repository.
But I'll talk more about that later.
So I'm going to create it.
I'm not going to add a read me file.
I'm not going to add a good ignore.
I'm not going to choose a license.
I'm just going to create the repository.
And then it gives me instructions.
So I create this repository and it says, quick setup.
If you've done this now, we're going to skip that or create a new repository.
We've already done or push an existing repository.
That's what we want.
So I'm going to copy this first line, go back to my terminal, clear the screen pasted in.
Great.
That's done.
Then I'll go back to the my instructions.
Copy this line, which creates the main branch and then copy the third line and push it.
Push perfect.
So it is pushed now if I come back to this page on GitHub, which is just GitHub dot com, slash your
username, slash whatever you called your repository and refresh the page, you'll see that my source
code is now up there and it has this little note here.
Help people interested in this repository understand your project by adding Rebbie.
Well, don't do it here.
You can if you want to do it over here.
So all you need to do is to go to the root level of your project and create a new file, a new file
and call it README.
And it does have to have this name read me DOT M.D., which stands for Markdown and it creates a new
blank file and mine helpfully starts up a kind of preview for markdown.
Markdown is just a common way of putting information up and specifying certain formatting without using
something like Microsoft Word, because you don't know that somebody has Microsoft Word or pages on
a Mac or whatever it may be.
Read me is just a way of formatting things really quickly.
So I'm going to give my project the title and you do that by giving typing a hashmark and then just
whatever you want the title to be.
And my title will be Bookings and Reservations.
And I get a preview over here.
I don't know if you do in visual studio code or not, then I'll have some paragraph of text underneath
it.
This is the repository for my bookings and reservations project.
It's always good to say what's used to build this.
So I'm going to create a list built in go version and whatever version you're using, I'm using one
point one five.
No external, no external dependencies uses the key browser uses Alex Edwards as CSC Session Management.
What other what other things are we using?
Lists are going to go mod.
Oh yes.
No SIRF so I'll copy this and go back to my read me.
Uses no surf, and I'll make that actually a link and I'll make it olinka, forget which way it goes.
I think it goes like this.
We'll find out.
And then there's no other way around square brackets around what you want the link to look like.
And parentheses around what you want it to link to, and this creates a hyperlink.
All right, so I've created that.
I should probably do the same thing for Alex Edwards just so I can quickly get where it's going.
And she saw a copy that come back to the read me uses the key rotor, which goes in square brackets.
And then in parentheses, the link and yes, I'll go back to go mode, find Alex Edwards, copy that.
Go back to my read me and I will put this in square brackets.
And then in parentheses, the link that it goes to.
All right, so that should do it probably should put an https in front of this, it might be smart enough
to figure it out, but.
You never know.
All right, so I made a change to this file.
The thing that should be showing up here is it should be saying, hey, you're using a git repository.
One of the nice things about using Git and an idea is that typically it will show you what files have
changed over here by changing their color.
So I'm going to go to Goaland, choose preferences, look for version control, and I am going to add
a directory or actually I can probably just quit out of this and then start it back up.
And it should realize there's a git repository once it starts up.
And it did so you notice that this one is in red and it's it's similar, I believe it is red as well
in visual studio code.
So what I'm going to do is say that so I can just click on this a right click on this and choose, get
and choose.
And now it's been added.
OK, so the change has been made here, but it's not been pushed to the git repository yet.
So I can go to PVCs, which is version control system and I can choose, get push and I will push it.
Now I'm not going to do it right now because I want to start a visual studio code and do it from there
to see how it works in that one.
So you don't have to take this step if you're using goaland.
But if you're on Visual Studio Code, let's look and see how it works there.
So acquitted of this.
I'll start up Visual Studio Code.
It remembers where I am, I don't want to be there, so I'll just say open.
I will find my bookings folder and open it.
And over here, it says, hey, look, your Gomaa has changed and you read me, it's changed as well.
So let's push these things to PVCs.
And over here on the left hand side, that looks like source control to me.
That's my version control system, which Microsoft calls source control, which is fine.
So I'll click on that.
And I will say up here, what do I have?
I have Torgau view mode.
I have commit.
I refresh you and more action.
Let's push it.
I want to push this to get so often goes.
I push it to get and it says would you like to code to.
Yes.
Run git fetch periodically.
Sure.
Why not.
So it should be pushed.
So hopefully if I go over to my git repository and refresh this.
Nope.
Didn't push it yet.
Commit and push, commit staged there and the commit is added a git repository, and now I can push.
Let's push it push.
We're going away and it looks like it's done, so now I want to come back here and refresh this.
My reading should be there and it is so I added my read me.
I have my get ignore their all the files of their the get mad and get some.
Now, the great thing about this is this gives you a safety net.
Lets say I'm working away on my project for a long time and I start making mistakes.
And I said, man, I wish I'd saved a copy of this 20 minutes ago.
Well, it allows you to live with a little less anxiety in your life, because I can always roll back
to the last known good version of a Sourcefire, or I can go back to any version of the source file
every time I commit and push to get stores, a history for every single file in my project.
And I can even and will do this later on tag known versions of a project so I can say, aha, this is
done, this is now going to be version point five.
And I can anytime I want to go back to my git repository and look under here and you will see that we
have tags and we haven't created any yet, so there's nothing there.
But we can create tags and go back to a known good version of it.
The other nice thing about this is if, like me, you work in more than one place.
I work in an office that has a computer and I work at home that has a computer and I have a laptop,
I take places.
So I have three different places that I regularly work.
One of the things that is great about get is I can work on one machine, then push and push my changes,
go home and just pull from that repository.
And then I have exactly the same information on my home computer as I do in my office computer.
So I encourage you to create an account on GitHub and push stuff up here because it will make your life
easier.
It's not necessary.
You can work with the local git repository, but if you're working in more than one place, things are
going to get out of sync very, very quickly.
So get is your friend.
All right in the next lecture will actually start creating some pages, just some static pages for a
website.
So we'll be exploring some some HTML, putting some graphics on figuring out how to serve static assets
because we can't do that yet.
You'll hear about that in the next lecture and we'll start mocking up what we want our final site to
look like.
That's enough for now.