31 Dec 2019
cat: Laravel, PHP
0 Comments

Laravel Repository Pattern Example

In this tutorial we will implement the repository pattern in Laravel. Repository contains the logic on how data is persisted and how to query the data. It will be most useful to avoid duplicate codes that execute the same queries and hide the complication from the code that wants the data.
15 Dec 2019
cat: Angular 2+
0 Comments

Angular 8 OAuth 2 Keep-alive with Refresh Token

When authenticating to OAuth, the access token is usually short lived and expires after a few hours or minutes. Some apps will want to use the refresh_token grant to refresh the access token to keep the user logged in. In this tutorial we will create an Angular app and with keep-alive using @ng-core, @ng-keepalive, and angular-2-storage for storing tokens.
30 Nov 2019
cat: Angular 2+, API
2 Comments

Angular 8 OAuth2 Authorization Code Flow

In this tutorial we will create an Angular application that authenticates to an OAuth2 server with Authorization Code flow. The app will redirect to the OAuth2 server's login page. After logging in, the user will be redirected back to the app and get access token and refresh token.
07 Oct 2019
cat: Express, Node
14 Comments

Express JS OAuth 2 Server using oauth2-server package

OAuth2-Server is quite a popular package for implementing OAuth authentication for Node JS but the examples provided on express-oauth-server on GitHub is outdated and does not work. In this tutorial we will create an OAuth 2 server using Express JS and test using postman
02 Dec 2018
cat: Laravel, PHP
0 Comments

Laravel View-models

In this tutorial we will make a base view-model to easily map request body to the view-model's properties. View-models helps you present data to your views or response that cannot be presented with your existing models and it also helps clean up your controller from view logic. You could also transfer the validation logic from your controller to your view-models.
16 Jun 2018
cat: Laravel, PHP
0 Comments

Upload Laravel Codes on a Shared Hosting

For some reason you want to upload Laravel codes on a shared hosting. Maybe just to upload a sample application, a prototype, or you don't want to use a cloud based hosting like Digital Ocean and find a cheaper hosting. In this tutorial we will  go through the steps on how to upload a Laravel Application to a cPanel.
19 Mar 2018
cat: Angular 2+
0 Comments

Angular 4 – HttpClient Mapping using Decorators

In Angular 4 we use HttpClient to perform AJAX request. HttpClient does help with type hints unlike the old Http but it does not really map to a typed object, it only returns a JavaScript object. In this tutorial we will use decorators to help with mapping properties. With this technique we don't have to map every JSON response from AJAX to typed objects, we just decorate properties of a class.