Coder Social home page Coder Social logo

googlemaps's Introduction

cmpe273-Assignment2

google map in go language

#What is the code about ? This program aims at making use of the Google maps API in order to fetch the coordinate locations of a user given address. I have tried implementin basic CRUD operations like illustrated below :

  1. Create

This uses the POST verb of a REST API . Here the user gives input in the following format through the link(http://localhost:8082/locations)

{

"Name" : "namitha ninan",

"Address" : "101 san fernando",

"City" : "san jose",

"State" : "CA",

"Zip" : "95112"

}

The program reads this from the body of the request and provides the address to Google Map API which then returns the coordinates. This is then fed into MongoLab along with a unique ID to identify it by later

{

"id": "5666312266bae326c4708949",

"name": "namitha ninan",

"address": "101 san fernando",

"city": "san jose",

"state": "CA",

"zip": "95112",

"coordinates": { "latitude": -121.887067, "longitude": 37.336259 }

}

  1. Read

Get command is used to retrieve the data of a specific id from the database and display it to the user. On giving the address http://localhost:8082/locations/5666312266bae326c4708949, we'll get the same output as shown above as the id's provided are the same.

  1. Update

Put command is used to update/change the input given. Similar to get we specify the id of the record to be altered http://localhost:8082/locations/5666312266bae326c4708949

Now suppose we change the name and address and give the following input,

{

"Name" : "Abhishek Gupta",

"Address" : "villa torrino apartments",

"City" : "san jose",

"State" : "CA",

"Zip" : "95112"

}

We now get the modified output for the same id

{

"id": "5666312266bae326c4708949",

"name": "Abhishek Gupta",

"address": "villa torrino apartments",

"city": "san jose",

"state": "CA",

"zip": "95112",

"coordinates": { "latitude": -121.8847222, "longitude": 37.3456227 }

}

  1. Delete

This is as simple as using the Delete Verb and providing the same link as above where we specify the id to be deleted

googlemaps's People

Contributors

namithaninan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.