This project uses an excel file from San Francisco's Data Source to fetch all food truck locations around the city. The project uses Azure Maps to plot trucks on a map and determines the distance to the truck from the center of the city.
The finished product can be found here: https://foodtrucklocator.azurewebsites.net
The project is a web application that connects to Azure Maps to render a map display with a search box. The web application uses Azure Maps SDK to make calls to the service. The application has been deployed to an Azure Web App and uses Azure DevOps for continuous deployment.
The code is based off the sample Store Locator code provided by the Azure Maps product team. The code is written in Nodejs and the web application code can be found under the FoodTruckLocator folder.
Webpack was used to bundle the code into a single directory for deployment. The Dotenv component was installed and can be used with webpack to create and store environment variables using an .env file. Currently the Azure Maps authentication key is stored in the file with a variable of AzureMapsKey. Webpack also allows us to test the code as it runs witin an Azure Web App.
To run the code on a local machine the following should be taken after cloning the project:
- Create an Azure Map object in Azure and copy the Authentication Key.
- Create an .env file and add AzureMapsKey=<Authentication Key from step 1>
- In the terminal window move to the FoodTruckLocator folder.
- Run npm install
- Run npx webpack -- config webpack.config.js
- To start the website run: npm run start
Mocha was used for creating and running unit test. The unit test files can be found under the Test/Data folder. Do to the time limit, only one unit test was created to test the parsing of the excel file.
The project uses git as its source control with two branches. The master branch contains the code that is deployed to Azure. The elizagr branch is the development branch for myself. Additional branches can be added as more developers work on the project. Each branch uses the developers alias or username. A pull request must be done to add code to the master branch.
The project does not allow rebasing. The reason is that Azure Maps is in preview and as coding occurs, issues may arise that we want to capture in the history but do not want to add to the production code.
Once the master branch is updated, Azure DevOps has a pipeline that was built for continous deployment to the Azure Web App.
At this time there are few items that did not get completed due to time constraints:
- The search is working, but searches the entire country.
- The images and icons still use the Coffee images. Need to update to trucks.
- Prettier was installed and configured to help format the javascript, but not used. Need to go back and format the code.
- Create an ARM template for deployment using Zip file.
- Azure Maps (main site)
- Azure Maps Documentation
- Azure Maps Blog
- MSDN Forums
- StackOverflow [azure-maps]
- Azure Maps feedback
MIT
See License for full license text.