Front-end and back-end are terms used to characterize program interfaces and services relative to the initial user of these interfaces and services. (The "user" may be a human being or a program.) A "front-end" application is one that application users interact with directly. A "back-end" application or program serves indirectly in support of the front-end services, usually by being closer to the required resource or having the capability to communicate with the required resource. The back-end application may interact directly with the front-end or, perhaps more typically, is a program called from an intermediate program that mediates front-end and back-end activities.
The cloud is a term referring to accessing computer, information technology (IT), and software applications through a network connection, often by accessing data centers using wide area networking (WAN) or Internet connectivity.
Almost all IT resources can live in the cloud: A software program or application, a service, or an entire infrastructure. For example, if a business wanted to build an IT infrastructure, typically it would install the servers, software, and networking resources it needed, but nearly all of those services and resources are now accessible by going to third parties that offer them in the cloud.
In this project I am using Amazon Web Services (AWS) which is a comprehensive, evolving cloud computing platform provided by Amazon. It provides a mix of infrastructure as a service (IaaS), platform as a service (PaaS) and packaged software as a service (SaaS) offerings. Amazon Web Services provides services from dozens of data centers spread across availability and more than 100 services comprise the Amazon Web Services portfolio, including those for compute, databases, infrastructure management, application development and security.
Cloud Server
Amazon Elastic Compute Cloud (EC2) provides virtual servers or computing instances that can be scalable in terms of computing power and memory, flexible by providing the option to host applications on multiple different platforms, and secure thanks to a tightly coupled multitenant architecture. Amazon EC2 enables the provision of a virtual server, which can incorporate massive amounts of computing power. This is available on a subscription-based utility computing model, and the user is billed only for the resources used.
Amazon Elastic Compute Cloud is a pioneer cloud infrastructure product that allows users to create powerful virtual servers on demand. Amazon EC2 is hosted on the server consolidation/virtualization concept, where the entire computing power of server hardware can be divided into multiple instances and offered to the end-user over the Internet as a computing instance.
Because the computing instances provided are software based, each unique instance is scalable and users can create an entire virtual data centers over the cloud. Amazon EC2-created instances can be accessed by open-source Simple Object Access Protocol (SOAP) application programming interface (API) support, giving developers the liberty to create various types of applications, just as with an on-premises computing infrastructure. The instance provided by EC2, commonly known as a virtual machine, is created using Amazon Virtual Image and is hosted over Xen Hypervisor, a server virtualizing software.
Amazon EC2 virtual servers used in the application as cloud server which running Ubuntu 16.4 operating system, and it can be accessed using SSH connection for example command below.
Term Backend comes from (BaaS) Backend as a Service is a cloud computing service model that serves as the middleware that provides developers with ways to connect their Web and mobile applications to cloud services via application programming interfaces (API) and software developers' kits (SDK). BaaS features include cloud storage, push notifications, server code, user and file management, social networking integration, location services, and user management as well as many backend services. These services have their own APIs, allowing them to be integrated into applications with relative ease. With this project there are services used to operate CareBud backend such as (Node.Js, MongoDB Server, Express.Js, mongoose and other related services).
In the above scenario when user try to communicate with cloud using CareBud application an Api requests such as (GET, POST, PUT and DELETE) will performed during this process which that managed using Node.js is a lean, fast, cross-platform JavaScript runtime environment that is useful for both servers and desktop applications. Express.js, or simply Express, is a web application framework for Node.js, released as free and open-source software under the MIT License. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js. In the application when user start to sign Up, on submit a POST request will be created and call an API with SignUp route so data can be stored in the cloud storage (MongoDB) using mongoDb Client.
An example code snippet used to call Post Api from CareBud Application SignUp Screen in encrypted format:
The data need to be send and formatted using JSON even when the response received it will be in JSON format. Another snippet show the Server side code for that operation when user POST his data, user account with all details will be created and posted to the MongoDB server.
//create new user
router.post(routeDir, function (request, response) {
console.log("Creating User Data", request.body);
User.create(request.body).then(function (success) {
response.status(200).send({statusMessage: "Success", status:
"200", data: success})
console.log("User Created", {statusMessage: "Success",
status: "200", data: success});
}).catch(function (reason) {
response.status(404).send({statusMessage: "Fails", status:
'404', reason: reason})
})});
//THE SERVER SIDE POST OPERATION
After creating the account response will be sent to the application with the created encrypted data with status 200 which mean Object created successfully, snippet below show example response:
Same process happened when the user perform other requests such as PUT, DELETE and GET, below example for adding Doctor D1 to Patient list in the server side.
{
statusMessage: "Fails",
status: '404',
message: "this user id not found",
reason: "User Not Exist"
}
If the user type is patient then the user will be asked to connect his smart watch so to be able to get user health reports and then at that time we are getting the reports then we encrypt it so to be stored in the cloud using the following APi:
Create Patient Health Report
POSThttp://18.212.177.76/api/patientHealthStatus
Create patient health reports
Headers
Name
Type
Description
Content-Type
string
application/json
Request Body
Name
Type
Description
user_id
string
user account Id
healthStatus_name
string
test report name(HeartBeat/Body Temp/BloodPressure)
healthStatus_description
string
test report description
healthStatus_value
string
test report value
healthStatus_previousValue
string
test report previous value
healthStatus_unit
string
test report unit
effectedTime
string
test report taken time
previous_effectedTime
string
bloodPressureReport
string
if the test is blood pressure require another values
{
"statusMessage": "Success",
"status": "200",
"message":"Report created successfully!",
"data": {
"user_id":"5b73aa608637cdb228952efb",
"healthStatus_name" : "Blood Pressure",
"healthStatus_description" : "blood pressure as a combination of a systolic blood pressure and diastolic blood pressure, and whether the patient was lying down, sitting, or standing when the blood pressure was obtained.",
"healthStatus_value" : null,
"healthStatus_previousValue" : null,
"healthStatus_unit" : "mmHg",
"effectedTime" : "2018-08-11T08:40:27.022Z",
"previous_effectedTime" :"2018-08-11T07:30:27.022Z",
"bloodPressureReport" : [
{
"systolicBPValue" : 160,
"previous_systolicBPValue" : 160,
"diastolicBPValue" : 60,
"previous_diastolicBPValue" : 60
}
]
{statusMessage: "Fails", status: '404', reason: "Required parameter is missing"}
When we are posting the health report to the backend we encrypt the whole report, the following example show how the report looks like before storing it in the cloud.