[S20_WebFund] HW#7/8 金融與國際企業學系 - F08275203 - 杜尼可

Group content visibility: 
Use group defaults
Groups audience: 

Lab 7

1. Screenshot

2. Experience

In this Lab assignment I implemented google maps into my GitHub Page. The google documentation was pretty straight forward in how to do it. Although you need an account in the google cloud platform to create a project and a key. Unfortunatly I can only use the default/developer mode of maps, because for the real implementation you have to pay. So just because of the fun I researched how to center the map new and set a marker on a location. You can see this in the code above. Although it isn't working, because I don't pay for calls to the API I think this is a lab assignment which was very interesting. 

3. URL: https://doeringi.github.io/crftofcoffee/index.html


Lab 8

1. Screenshots

Create Database

Here I created a local database in the phpmyadmin console.



Fill Database

In this Project I used Laravel (a PHP framework). Artisan is the command line interface of Laravel. With these commands it helps you build your application easier. Tinker is a REPL (read–eval–print loop) with which you can interact with the database (or the Laravel ORM = Object-Relational Mapping), of laravel. Here I inserted a user and two posts (as you can see in the next screenshot). In this step these objects are only saved on the local storage. The next step is to migrate the changes to the database.



To finish up, I migrated the changes with the command shown in the screenshot.


PHPMyAdmin Console

Now you can see the user that I migrated in the phpmyadmin panel.


API Controller

To build a service we need CRUD (Create/Read/Update/Delete) functionality. For example purposes I implemented a "read" functionality to get all posts from the database as a JSON file. Other applications who use the "api" of this application will use the JSON file to process the information. Because Laravel is based in MVC (Model View Controller), this functionality is handeled by the Controller.


Setting up the route for the controller.



After I built up the read functionality in the controller, I wanted to write a PHP Unit Testto test, if the functionality is given. Here I ran into several problems, because I always recieved an error message while running the test. After a long research on the problem, I found out, that apperently testing in Laravel is not possible or faulty.


JSON Output

To test in a different way, I created a view to output the pure JSON format in the browser.

2. Experience

This Lab assignement was very challenging. I encountered several problems, especially in the testing. Furthermore I tried to deploy the website with a hoster, but unfortunatly couldn't get it to work. I tried 000webhost, GearHost and Heroku. Both GearHost and Heroku didn't support my PHP version. GearHosts disk space was also limited and I reached the limit very quickly. 000webhost also had limited disk space, which I exceeded. I hope I can manage to find a solution to deploy my final project too. 

All in all it was a very good experience and practice to configure a database and learn laravel as framework for php. It was also the first time I used the command line more often that I would've. It is very convinient and I will try to learn more about commands to build up projects faster.

3. URL

As mentioned before, unfortunatly I was unable to deploy my application, due to disk space and php version issues. If I find a way so resolve the problem I will update this post.

For 000webhost I used the following description to deploy.


Personally it still didn't work for me (even though I tried several different configurations in different files), but it might help someone else who is reading this.

For what it's worth, this is the broken link which doesn't work: https://storenico.000webhostapp.com/



After researching and error handling I finally found the limiting factor for 000webhost. It is the number of files that can be uploaded (or what they call "Inode Usage Quota"). It is limited by 10 000 files. A quick look at my project folder and I realized I have 24,689 files, which means after extracting my zip folder on the file manager, not all the files where extracted. Hence the error message. It can't find the files to execute autoload_real.php on line 69.