We have posted article for how to learn nginx commands in Ubuntu for beginners. First of all, NGINX is a free, open-source, high-performance HTTP server and reverse proxy, high performance, stability and used for micro services, simple configuration, load balancers and API gateways.
In this post we have explained about how to create a RESTful API with HapiJS and NodeJS and MYSQL. Many web applications they provide API to access their data via RESTful. This process is called as web services. We have implemented RESTFUL API using NodeJS with MYSQL Database using Hapi JS web services.
When you are integrating google maps for locations you may need to know their latitude and longitude values. In that time pass your address through maps.google.com for api request.It returns the values as json output. The values are stored into database. So next time you can search the location in table. If it is not found you can send api request and store it.Why we are store the values in database because to avoid of frequent usage this is free api even it has some limit of access. when we frequent request the server doesn’t respond immediately. So that’s why we store the values.
$lat = $output->results->geometry->location->lat;
$long = $output->results->geometry->location->lng;
CREATE TABLE `test`.`geocode` (`location_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `city_name` VARCHAR(255) NOT NULL, `latitude` VARCHAR(255) NOT NULL, `longitude` VARCHAR(255) NOT NULL, `status` TINYINT(2) NOT NULL DEFAULT '1' COMMENT '1-Active,0-Deactive') ENGINE = InnoDB;