Welcome to Ed2Ti Blog.

My journey on IT is here.

SWAPI - Star Wars API

- Posted in Uncategorized by

Hi everyone.

I hope you enjoy this post because It's part of my first job test, as a developer, in Canada. Well, in February I apply for a job at (Let's call Yoda) Yoda company. On the same day, a girl from Yoda company (Let's call Leia Princess) call me. (It was so fast). On Friday, with power chaos in Montreal, I did my first technical interview and they send me this challenger.

Contextualizing:

Target: Create an application to get a list of People, Planets, and StarShips and implement a search on People using SWAPI. Need to use a framework and show how to install and test the web application. All information needs to be posted on GitHub.

To be honest, I did more than one solution.

  • All with Vuejs (on my GitHub)
  • All with PHP core (on my GitHub) - Horible. (I'll change everything)
  • Frontend with React and backend with PHP (I did an API server) - Was interesting. (need to correct) (on my GitHub)
  • All with Laravel - This one (on my GitHub)

Let's talk a little bit about an item (d)

About SWAPI: It is strikethrough textstand for "Star Wars API". It is a free, open-source web service that provides access to data from the Star Wars universe, including information on characters, planets, films, species, vehicles, and more.

Laravel is a popular, free and open-source PHP web application framework that follows the MVC pattern. It provides a range of features to simplify web development, such as authentication, routing, caching, and database management. Its intuitive syntax and extensive documentation makes it easy to use, while its focus on developer productivity and code readability make it an excellent choice for building scalable and maintainable web applications.

About my project.

You may ask. Why do you just use 2 routes if you have at less 3 different views?

My routes are: Route::any('/search', [swapiController::class, 'search'])->name('search'); Route::get('/{resouce?}/{param?}', [swapiController::class, 'show'])->name('show');

The first one is any route. If I receive a POST, I'll process a search request. Otherwise, if I receive a GET I'll redirect to the index view.

The second one is a generalist route.

{resouce?} = people, starships, planets. {param?} = receive the page.

The controller, swapiController, has all the logic to make a distribution of actions. I'll try to simplify more, but now, Im finishing a project from my professor at Trebas.

I need to finish this post with a simple msg for him and for Alfredo Menezes. Thank you Iyard for help-me and support-me every time. Thank you, Alfredo, for introducing me to the Yoda Company.

** Thank you, Princess Leia. You were so patient **

GitHub: https://github.com/ed2ti/swapi-laravel

Professor: Iyad Koteich