Skip to content

khuppenbauer/netlify-geolib-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netlify-geolib-functions

Use geolib as netlify function

Simple API to run the Geolib functions as serverless functions on netlify. Find out more about Geolib and netlify functions at the original Resources

Install

yarn install
yarn dev

This starts a local Lambda server. After that you can test the endpoints with Postman. Install Postman and import the Collection from the static folder. In my case the local Lambda server is listening on 9000, so the variable base_url_geolib is

http://localhost:9000

You can change this variable in the Collection Settings or add your own Environment Variable.

Usage

To use the API make a HTTP POST Request and pass the arguments as json in the body

Example

Method: POST

Endpoint: /getDistance

Query: body

{
	"start": {
		"latitude": 51.5103,
		"longitude": 7.49347
	},
	"end": {
		"latitude": "51° 31' N",
		"longitude": "7° 28' E"
	}
}

Deploy to netlify

Deploy the functions to your netlify account by clicking the button und following the provided steps.

Deploy to Netlify

Afterwards you will find the functions under the functions item in your netlify project. To test the endpoints with the Postman Collection you have to change the base_url_geolib variable to your netlify site name and the funtions path

Releases

No releases published

Packages

No packages published