Hackyo’s Update — Week 8

What Have I Done?

Done Creating API

The hardest part is that deploying MongoDB takes much time :(. (testing whether it works or not).

Anyway here’s the code that I use to code the API:

And of course, I set the routes.php on our laravel so It can connect to this controller

First I tested by randoming only by one quote, now it can do random with the input request.

So by inputting this URL:

url.com/api/getQuote/{jumlah}

You can get the quote by {jumlah}

And also by inputting this

api/getQuoteByAuthor/{jumlah}/{author}

You can get the quote by {jumlah} by {author}

And also by inputting this

api/getQuoteBySource/{jumlah}/{source}

You can get the quote by {jumlah} by {source website}

The problem that I encountered when I code this part is the efficiency of calling the database. Before, I called all the collection over and over so that it will become inefficient. After that I refactor my code so that It will become more efficient.

Time

10 hours(Testing my API and refactoring my own code takes time)

Write this blog takes 1 hours

— — -

EndWord

Sorry, I am sleepy right now..

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.