A sample Azure Functions - API project to retrieve and create tourist attractions for Marrakech.
In order to run this project, please follow the steps below:
- Use a compatible Node.js version (Node.js 14 or 16)
- Install the Azure Functions Core Tools
brew tap azure/functions
brew install azure-functions-core-tools@4
# if upgrading on a machine that has 2.x or 3.x installed:
brew link --overwrite azure-functions-core-tools@4
- Install the dependencies:
npm i
- Run the sample:
npm start
Note: more information can be found on the Azure Functions Core Tools documentation.
Once you completed the above steps, you can run the projects as follows:
npm start
: Runs the sample- Press
f5
: This starts a debugging session in VS Code. Now you are able to set breakpoints and step through the code once you call the API.
GET http://localhost:7071/api/attractions
: returns a list of attractionsPOST http://localhost:7071/api/attractions
: creates a new attractionGET http://localhost:7071/api/attractions/{id}
: returns a attraction by id
The body of the POST example show have the following structure:
{
"name": "Hotel Spa",
"description": "The perfect place for us to rewind."
}
Important: the
name
,description
fields are required.