Crating My first Api Using $Git -2

in LeoFinance2 months ago

Oh wow!!! So it took me exactly 4days to begin building my Api locally after my last post? Well, this wasn't my plan because I planned to make at least one post every day. But you know, things don't just work how you plan them. But then, I'm so excited to be back with the second post of my journey on Crating My first Api Using $Git.

In this part of my journey, I will be sharing with us all how I was able to learn the followings;

  • Proper installation of the tutorial prerequisites
  • Creating a project using Laravel and configuring my project's .env file
  • Creating a Database
  • Enabling authentication feature
  • Adding UI Configuration
  • Migrating database

Problem Faced During Tools Installation.

So, the tutorial I was flowing didn't give the full gist on how to get the required tools installed properly. But I'm glad I scaled through that process even though I faced a few issues which I'll be sharing below.

TO get started, we need to install 3 to 4 software on our machine and they are;

My first mistake was to randomly install the software unknowing that it's compulsory to first install XAMPP before installing Composer. This is because Composer needs a file from XAMPP before it'could be installed.

Creating A Project Using Laravel

After installing the tools successfully, Launch your Command Prompt window or terminal because that'd be where we'll perform most of the tasks. Although, In this section, we'll create our database outside of the Command prompt window.

  • Run the following after launching CMD to create a project
    composer create-project laravel/laravel MyAPIProject


  • Creating A Database For My Project

While my project is being created, launch Xampp and turn on the services displayed below

After the configuration is running, we can now open any browser then head to http://localhost/phpmyadmin to create a database for our project. In this process, we aren't gonna run any command but just by clicking a few buttons and it's simple. As you can see, I named my database myprojectapi.

Since our project and its database is created, let's head to our project file inside our system file explorer to edit a file called .env. Here's how it looks like;

All we have to do here is to change the following before to after as shown below;





Now, launch a new command prompt then run php artisan serve the following lines of codes will be displayed.

Starting Laravel development server: PHP 7.4.10 Development Server ( started

we can now run our localhost on Below is a screenshot of my project after I accessed on my chrome browser.


Enabling Authentication Feature

Adding Register and Login feature to our localhost page is easy with Laravel. All we have to run is composer require laravel/ui and these features will be added automatically.

To customize these newly added pages, we'll have to run a few more codes.

  • php artisan ui vue --auth
  • npm install
  • npm run dev

After successfully running these codes, our Register and Login option should be created.

At this point, I experimented and observed that the Register button is working fine but trying to login won't work until we migrate our database. The migration of database is also easy to perform with Laravel. Kindly run php artisan migrate to carry out the migration.

After the above task is done, we can now register user and login with our details. We will also be able to view your registered users via the database we created initially. In my case, i registered a user with the name Testing1.

That's all for this post. CONGRATULATIONS for we've successfully created a laravel project, database, and configured Register and login options. We'll do more in our next lesson.

Posted Using LeoFinance Beta


Congratulations @rufans! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 20000 upvotes. Your next target is to reach 25000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP