Adding generateLocationMessage in the message.js file

Now the function that we're about to create is going to look really similar to this, we're going to take some data in and we're going to return an object. The big difference is that we'll be generating that URL as well. Instead of from, text, and createdAt, we're going to have from, URL, and createdAt.

We can make a new variable, we can call this variable generateLocationMessage, and we can go ahead and set it equal to a function that takes those three arguments from, latitude, and longitude:

var generateLocationMessage = (from, latitude, longitude)

Now we can finish off the arrow function (=>) adding the arrow and our curly braces, and inside of here we can get started by returning the ...

Get Advanced Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.