An open API service indexing awesome lists of open source software.

https://github.com/groda/locate-me-now

Show your location on a map
https://github.com/groda/locate-me-now

glitch leafletjs location-services openstreetmap

Last synced: 12 months ago
JSON representation

Show your location on a map

Awesome Lists containing this project

README

          

![locate-me-now](https://socialify.git.ci/groda/locate-me-now/image?custom_language=Node.js&font=Source+Code+Pro&language=1&logo=https%3A%2F%2Fcdn.glitch.global%2F6c31fb7f-564c-4070-b8a2-6a84d079e5cd%2Fkoala-4373467_640.png%3Fv%3D1727655948257&name=1&owner=1&pattern=Solid&theme=Light)

# 🚀 Where Am I?

Show your current location on a map 🌍.

## 🌐 Run on Glitch

Simply click the link below to run the app on Glitch:

[**Locate Me Now on Glitch**](https://locate-me-now.glitch.me/) 🚀

> **Note:** The app is hosted on **Glitch**, which will be shutting down its app hosting infrastructure soon. Please refer to the [announcement](https://blog.glitch.com/post/changes-are-coming-to-glitch/) for more details. In the future, I might need to consider migrating to another hosting platform. 💡

## 💻 Run on Your Local Machine

This guide is for **Mac OS**. Follow these steps to run the app locally on your machine:

1. **Download Node.js®**

Get Node.js from [here](https://nodejs.org/en/download/package-manager).
(For Mac, I recommend **v20.17.0 (LTS)** / macOS / using **nvm** for version management.)

Open your terminal and run the following commands:

```bash
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

# Download and install Node.js (may require restarting the terminal)
nvm install 20

# Verify the correct version of Node.js
node -v # should output `v20.17.0`

# Verify the correct version of npm
npm -v # should output `10.8.2`
```

2. **(Optional) Use Specific Node Version**

Not sure if this is required, but if needed:

```bash
nvm use 20.17.0
```

3. **Install Express**

To install the required dependencies:

```bash
npm install express
```

4. **Clone the Repository**

Clone the repo to your local machine:

```bash
git clone https://github.com/groda/locate-me-now.git
```

5. **Change Directory**

Navigate into the project directory:

```bash
cd locate-me-now
```

6. **Start the App**

Run the app with the following command:

```bash
node server.js
```

7. **Access the App**

Once the app starts, you should see a message like:
`Your app is listening on port 59257` (port number may vary).
Open [http://127.0.0.1:59257](http://127.0.0.1:59257) in your browser to view the app in action! 🌐

## 🛰 How It Works

The app uses the **Geolocation API** provided by modern browsers to determine your current location. It leverages the `getCurrentPosition()` function, which you can learn more about in the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition). This function retrieves the geographic location of your device, allowing the app to display your position on a map! 🌍📍