Before starting the tutorial we should know few terms/tools/technologies. Some of you already know these terms/tools/technologies. If you are new in REST API development and server then don’t skip this part!
- Backend Server
- REST API
- Virtual Server
Here for you, I won’t make it complex! They have their official meaning and definition but I am giving you simpler idea about them.
Official Definition: The backend (or “server-side”) is the portion of the website you don’t see. It’s responsible for storing and organizing data, and ensuring everything on the client-side actually works. The backend communicates with the front-end, sending and receiving information to be displayed as a web pageSource
Simple Definition:: We save and get our data through Backend Server. It holds our databases like MySQL, MongoDB etc.
Image : Demonstrating how we save data and get data from Backend server
Official Definition: A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.Source
Simple Definition: To save and get our data from our database we need a communicator. REST API is that communicator here. It will help us to save data from any platform ( Android, iOS, Web etc.) to our database and pull those data to any platform ( Android, iOS, Web etc.) according to our needs. That means whatever we are developing (Mobiles app / Website / Game), REST API will provide us necessary data properly.
Photo credit : www.phpenthusiast.com
Official Definition: A virtual server is a server that shares hardware and software resources with other operating systems (OS), versus dedicated servers. Because they are cost-effective and provide faster resource control, virtual servers are popular in Web hosting environments.Source
Simple Definition: To understand what is a virtual server we need to know about, what is a server?
A server is like a normal computer as we daily use. It has Processor, RAM, HDD, SSD and necessary hardware. But the difference is, it is way more powerful than our normal average PC. It may have multiple processors, huge amount of RAM, large HDD or SSD and other necessary hardware. These are called Server PC. The server providers like Amazon, Google, Microsoft, Alibaba etc. companies have thousands of server PCs in their collection. They (Amazon, Google, Microsoft, Alibaba etc. companies) allow us to buy / rent some portion of their actual server as our needs. The way they provide us to buy / rent their server’s portion is called cloud server. Cloud server is nothing but using an actual PC or portion of actual PC located in other parts of the world such as USA, Singapore, China, UK etc. We use their cloud servers because they are very cheap and affordable.
Do you know?
We can create our own server if we have a normal PC and internet connection!
But our server won’t be faster and efficient as like the big companies because maintaining a server is very hard. I have attached an image of cloud server below:
Photo credit : www.racksolutions.com
So, how can we buy or rent cloud server and why we should?
Suppose you have designed a website for your company or client. You need to publish that website and its materials so that anyone can visit your website around the world. So, how can we do that? We can’t just sent the files to everyone to see my site! That is not efficient and that is hilarious!
We have to place or put our website somewhere safe and secure so that anyone can visit. In that case the term HOSTING or SERVER comes.
HOSTING or SERVER is a place which will allow everyone to visit your website from anywhere of the world. We just have to put the necessary files of our website in the HOSTING or SERVER.
Image : Tom, Jerry, Masud can visit your website from anywhere in the world
Now we understand that why we need hosting or server. Now let me clear you some other terms, Shared Hosting & Dedicated Hosting ( Shared Server & Dedicated Server)
Shared Hosting / Shared Server
Shared hosting is a type of web hosting service where multiple websites are stored on a single server that is connected to the internet. The users (customers) share the cost of the upkeep and maintenance of said server, which is why it is such an economic solution.Source
That means by shared hosting or shared server multiple customers can use a single PC or server. Suppose, there are more person like you those wants to host their websites in the server or hosting. So hosting providers or server providers allows you to use the same server to everyone to host all of your websites.
Don’t worry! In this method a person can’t see/use/delete/modify another person’s website files or data. They all will get separate control panels but same server.
Image : Multiple users / customers are hosting their websites on the same cloud pc / server by shared hosting policy
Can’t we just use a single server for our own?
The idea of shared hosting or shared server is to minimize cost. Suppose a server PC have powerful processor, 128GB RAM, 1000GB SSD. Maintaining this server in real life is too costly for individual like you and me! Suppose the rental cost of this server PC is 2000$ US dollar per month. Not everyone of us can afford this price!
On the other hand we don’t need to use this powerful server for our tiny website! So it will be more convenient for us to use shared hosting or shared server which starts from only 1$ per month and 12$ per year. That’s why shared hosting is more popular among the small companies and individuals.
Now, if our website is large and daily visitors or traffics are huge as like Youtube or Facebook then we must have to use a single server or hosting for this purpose. Because shared hosting is cheap but slow and storage is smaller. That’s why we need a single server called Dedicated Server. The cost of dedicated server is high but faster in speed and has large amount of storage according to your needs.
Now, What is a Virtual Server?
In the previous discussion we learned about server and server PC. Several operating systems can be installed in a single server PC, every single operating system works as separate server inside a real physical server. These are called virtual servers. An actual server or hosting can have several Virtual Servers. A Virtual Server use same hardware properties like processor power, RAM, Storage of actual server with other Virtual Servers.
Imagine only being able to run one software program at a time on your computer. What if, in order to check your email, you had to turn off your office application? What if you had to close your PDF reader in order to use the Internet?
While we take for granted that we can use more than one software application at a time, we seldom consider running more than one operating system at once. Virtualization software — programs that allow you to run multiple operating systems simultaneously on a single computer — allows you to do just that. Using virtualization software, you can run multiple operating systems on one physical machine.Source
Official Definition: Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.Source
Are you familiar with Sea Port?
If yes, then you are may be familiar with containers.
Container holds the goods or accessories inside it safely so that goods/accessories from another container can’t mix up. A large ship can carry thousands of containers at a time.
The definition of docker is something like that!
Suppose, an actual physical server is a Large Ship. The Containers in the that ship are the Virtual Servers. You can deploy your website / web applications / solution in each containers without disturbing other website / web applications / solution. Docker helps you to achieve that goal. Docker allows you to create multiple virtual servers (containers) inside one actual physical server (large ship). Those virtual server’s software ( such as database, database version) can be different from each other but they won’t harm or block one another because they are in different containers.
Example : Suppose I have a container with PHP version 5 and other container with PHP version 7.
Now, if I didn’t use containers I won’t be able to use both PHP versions at the same time. I had to disable one to use another if I installed those versions on my main physical server.
I think this is enough for this lesson. I am sorry for elaborating it but it was necessary for you who are completely new. See you next lessons.
Mahbubur Rahman Turzo
Full Stack Developer
Hi, I am Turzo. As a computer professional I worked for more than 6 years in Backend server development, iOS development, Android development, Game development, Robotics. I will guide you to acquire skills easily, efficiently and perfectly. I hope you will use these skills and knowledge in your real career as well as spread among others!