[Intro Music]
In this lecture, I will show you
how to get Unsplash API key and how
to insert it into the API microservice.
Let us know that this step
is mandatory for running this
project both either locally or
inside of the Docker. This way, if
you want to run this application on
your computer, you must get
Unsplash API key. Alright,
instructions are located in the
images-gallery folder. You could go
to it directly at github.com;
and here in the README.md file,
you'll find how to get actually
Unsplash API key, and how to
insert into the API microservice.
Also, you could open the same
README.md file located in the
images-gallery folder in the Visual
Studio Code, but it's more
convenient to read those
instructions directly at GitHub. So
you have to create
account at unsplash.com. Afterwards,
you'll create demo application
with title for example, 'Images
Gallery', and notice that the demo
applications are limited to 50
requests per hour. But that's
totally fine, for the sake of our
application, you will not
generate more requests for images.
Afterwards, after the creation of
the new application you will find in
the section 'Keys' key called 'Access Key';
and you need to copy it; and
afterwards you insert this API key
into the API microservice; and it
will get it as environment
variable. For that you have to
create '.env.local' file
inside of the 'api' folder; and in
this file, you have to insert just
single line 'UNSPLASH_KEY=',
and here you have to paste
copied Access Key from the
unsplash.com. Here is example how
this configuration should look like,
UNSPLASH_KEY; and here's a sample
key. Notice that this key is
invalid, so don't attempt to use it
in your application. Generate yours
under your Unsplash account. And
afterwards save modified
'.env.local' file. But now question,
why I asked you to create such file
and insert the UNSPLASH_KEY there?
Answer is very simple. This file is
ignored by Git, and therefore when
you commit changes it will not be
committed, and therefore, such
sensitive information as Access Key
will not be pushed, for example, to
remote GitHub repository. Because
this is correct approach when you
are handling different usernames,
passwords, access keys, and so on.
They should be stored only locally
on the server or computer where you
run your application. And we
require such key in order to run
API service actually in development
mode locally on your or my
computer. And if you for example,
deploy same application somewhere
into production, you will also have
to create such environment
variable as UNSPLASH_KEY; and
such configuration depends on the
actual service provider. But almost
always, there is a section called
environment variables where you
could set this and potentially
other environment variables which
are required by your applications.
Alright, that's quick overview of how
you could create UNSPLASH_KEY, and
insert it into the API service. And
now let's go step by step and
perform this task together. Let me
open up unsplash.com. And here, I
already have an account. If you
don't have one, please go to Login
and click here 'Join'. Fill information
about yourself. And afterwards,
click 'Join'. I'll go directly to
Login. And here let me enter my
Username and Password. Login. And
now please open up this URL. I'll
open it in the new tab. And here I
already have a few disabled
applications. In order to create new
application, please click 'New
Application' here. Check all check
boxes here. Please read carefully
all those API Terms of Use. Accept
Terms, and here please enter
Application name. I'll name it same
as before, 'Images Gallery'; and
Description will be the same, 'Images Gallery'.
Let's create new application.
Application was created, and here
you see tag 'Demo'. It means that
this application is limited to 50
requests per hour. But if you want
to increase rate limits, you could
apply for production. And here
following this URL, you could
read guidelines regarding that.
Alright, let me scroll down and
find Access Key, and here is mine.
Please copy it. Ensure that you copy
Access Key not Secret key. So let
me copy it. And now let's proceed
with further instructions. Now we
have to create '.env.local'
file inside of the 'api' folder.
Let's go there. Expand 'api'
folder. And here let's create
'.env.local' file. And here inside
let's add environment variable
UNSPLASH_KEY, and its
value will be set to just copied
key. Let's save changes in this
.env.local file. And please
notice that such file is grayed
out. And git does not offer me to
commit changes in this file. And
that's because that was 'gitignore'
file, which ignores such files as
.env.local, and other
environment related files. Alright,
now we are all set. And we went
through all those instructions. And
now you're ready to go and start
entire application that consists of
API and Frontend services. But as
I explained you before, you have
two options to run entire
application, either running
separately API and Frontend
services, or running all of them
simultaneously using Docker. And
I'll show you first how to run them
separately locally on your machine.
And in order to do so you have to
install Node.js and Python. And in
the next few lectures, I'll explain
to you how to do that. But please
notice that running of this
application locally without Docker
is completely optional in this
course. This way, if you don't want
to install Node.js and Python, you
could simply skip next few lectures
and continue following me when I
start Dockerization of API
and Frontend microservices. But
if you want to get your hands
dirty, and try to launch this
application without Docker, I
more than welcome you to do that,
because in such a way you will
deeply understand difference
between running applications
without Docker and with Docker.
Alright, in the next lecture, I
will show you how to get Node.js
installed on your computer.
[no audio]