Free knowledge blog: linux, programming, open source, databases, android, frameworks, web and computing in general
The files don’t have a structure, but like I said, it’s an example. I also write this because it either serves someone else or it serves myself for some references.
For data persistence it uses MySQL. This POS Save products and sales. It does not handle user permissions. We store the shopping cart in the session, and well, I better explain it in parts in this post.
Obviously this POS software is free and open source.
In this article about programming in the Go language (also known as Golang) we will see how to create a REST API that communicates through JSON, saving and displaying data from a MySQL / MariaDB database.
In the end we will have a REST API with Go using the 4 methods: POST, PUT, DELETE and GET using the Mux router. We are also going to implement the 4 operations of a database: insert, update, delete and select.
I will leave the full open source code at the end of the post.
Although there are millions of tutorials about MySQL and PHP, I decided to make mine but in a very very simple way. Before you start, you must have a basic knowledge in MySQL.
It is worth mentioning that we will not see good practices of databases, relationships, etc. We will use the tables as they are, without looking at normalization, or things like that.
Note: this tutorial uses PDO, but remember that we can also use
mysqli functions. Personally I recommend PDO, because it is object oriented. However, I hope to write a tutorial about mysqli in the future.