eCommerce API Demo
API Service
View the source and Docker file for the API service (opens in a new tab)
- Golang 1.22
- Docker compose
Using the Labstack Echo library, I created a simple http microservice that provides 50 random products. Product details are generated using the Faker library.
- Minimal microservice implemented in Go 1.22
- Http service will start on port 8080 and provide twp endpoints
- End point '/' will provide a JSON object of 50 random products
- End point '/:id' will return the product with the corrorsponding id or 'not found'
eCommerce Site
View the source for the eCommerce site (opens in a new tab)
- Laravel 10.10
- Livewire front end
- Websockets
- soketi (opens in a new tab) - for local websocket/pusher development
Using a base Laravel 10.10 installation I created Livewire components that allow the user to populate the database with products from the API Service. The livewire component UpdateProdcuts.php
(opens in a new tab) fetches the data from the API service using an HTTP client, this data is then passed to a Laravel Job process (opens in a new tab) that is responsible for importing each product into the eCommerce database.
Once completed a Laravel event is fired (opens in a new tab) that will trigger the ListProducts
Livewire component (opens in a new tab), via websockets/Pusher, to refresh the page, displaying the newly added products.