Skip to content

An express application that integrates with osm-teams

License

Notifications You must be signed in to change notification settings

developmentseed/osm-teams-node-example

Repository files navigation

OSM Teams API - Node/Express

This app demonstrates how to integrate with mapping.team, the index of OpenStreetMap teams. It uses Node.js/Express and simple-oauth2 to create the connection. mapping.team is an instance of the OSM Teams API

Requirements

  • Node.js v8+

App structure

On the front-end,

public/client.js contains the API code
public/style.css and views/index.html show the teams

On the back-end,

your app starts at server.js
the login code is in login.js
secret configuration goes in .env

Installation

Clone the repo

Clone this repo with git:

git clone https://github.com/developmentseed/osm-teams-node-example.git

Change directory into the repo:

cd osm-teams-node-example

Create your app on auth.mapping.team

To run this project you'll need a CLIENT_ID and CLIENT_SECRET from auth.mapping.team. There you'll log in using your OpenStreetMap account, then visit the create client page and follow these instructions:

  1. Add a name for your app
  2. The callback will be http://localhost:7171/callback or whatever URL this example is running on
  3. Click on "Add new App" to receive your credentials
  4. The CLIENT_ID is the client_id returned by the site
  5. The CLIENT_SECRET is the client_secretreturned by the site

Create the .env file

Create a .env file following the structure in .env.sample

CLIENT_ID=<your app client id>
CLIENT_SECRET=<your app client secret>
PORT=7171

You can copy .env.sample to get started:

cp .env.sample .env

Install the dependencies

npm install

Run the example

npm start

Now you should be able to see the example app in your browser at http://localhost:7171!

From here you can:

  • create teams on mapping.team and see them in a list on the example app
  • join other teams on mapping.team and see them in the list as well
  • check out the api docs and experiment with the api to get a better idea of how you can integrate mapping.team with your application