How to add google geo coding lookup and map marker using express with pug

google map market using node, express and pug

Purpose

In this post we will do the following:

  1. Lookup an address using google’s geocoding API
  2. Show it in a map by specifying a google map marker

We will do this in express using pug template engine

Include google maps api

First include the google maps api in your .pug file

script(async defer src="https://maps.googleapis.com/maps/api/js?key={your_key}&callback=initMap")

key: Is the google api key assigned to your account by google

callback: the callback function which would get invoked when the api loads. We will define this function in the next section

Define callback function: initMap()

Read more

Contact Us

Get in touch to schedule your FREE consultation!