|
| 1 | +# Participants' Home Towns |
| 2 | + |
| 3 | +## Tecnologies used in this project |
| 4 | + |
| 5 | +## NodeJS |
| 6 | + |
| 7 | +Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. NodeJS was the platform in which we built this application. |
| 8 | + |
| 9 | +## NPM packages used |
| 10 | + |
| 11 | +### [express](https://www.npmjs.com/package/express) |
| 12 | + |
| 13 | +Fast, unopinionated, minimalist web framework for node. This is the framework with which we built the application. |
| 14 | + |
| 15 | +### [dotenv](https://www.npmjs.com/package/dotenv) |
| 16 | + |
| 17 | +Dotenv is a zero-dependency module that loads environment variables from a `.env` file into `process.env`. Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology. |
| 18 | + |
| 19 | +### [node-geocoder](https://www.npmjs.com/package/node-geocoder) |
| 20 | + |
| 21 | +Node library for geocoding and reverse geocoding. |
| 22 | + |
| 23 | +### [ejs](https://www.npmjs.com/package/ejs) |
| 24 | + |
| 25 | +Embedded JavaScript templates |
| 26 | + |
| 27 | +## Prerequisites to run this application: |
| 28 | + |
| 29 | +### Google Maps API Key |
| 30 | + |
| 31 | +To use the Google Maps JavaScript API, you will ned an API Key. The [API key](https://developers.google.com/maps/documentation/javascript/get-api-key) is used to track API requests associated with your project for usage and billing. To learn more about API keys, see the API Key Best Practices and the FAQs. |
| 32 | + |
| 33 | +Read the [tutorial](docs/tutorial.md) and configure your [API Key](https://developers.google.com/maps/documentation/javascript/get-api-key) |
| 34 | + |
| 35 | + |
| 36 | +## Adding a new location |
| 37 | + |
| 38 | +The App reads its locations from the `locations.txt` file located in the root folder. It will consider each line a different location, so the file should look something like this: |
| 39 | + |
| 40 | +```txt |
| 41 | +New York, USA |
| 42 | +Brazil |
| 43 | +Japan |
| 44 | +``` |
| 45 | + |
| 46 | +To add a new location, simply append a new line to the locations.txt file |
| 47 | + |
| 48 | +There is also a `locations.txt.example` file that can be used to test the app. Copy its content to locations.txt and restart the app. |
| 49 | + |
| 50 | +## Running the application: |
| 51 | + |
| 52 | +To run this application locally, you'll need to: |
| 53 | + |
| 54 | +* Clone this repository: |
| 55 | +``` |
| 56 | +git clone https://github.com/MLH/localhost-github.git |
| 57 | +cd localhost-github |
| 58 | +npm install |
| 59 | +``` |
| 60 | + |
| 61 | +* Set up environment variables: |
| 62 | + |
| 63 | +There is a `.env.example` file that can be used to configure the app. Simply create a copy named `.env` |
| 64 | + |
| 65 | +```txt |
| 66 | +PORT= # Port to be used by the app |
| 67 | +API_KEY= # Google Maps API KEY |
| 68 | +``` |
| 69 | + |
| 70 | +Now inside the root folder run: |
| 71 | +``` |
| 72 | +npm start |
| 73 | +``` |
| 74 | + |
| 75 | +Now you can access locally in your browser the address `http://localhost:3000` and see your locations map. |
0 commit comments