Git Product home page Git Product logo

food-lookup-demo-rails's Introduction

API v3 Development Environment Setup

Instructions on setting up and running the v3 APIs locally.

Prerequisites

Before you begin, ensure you have met the following requirements:

1. You have installed .NET 7

OS Installers
Linux Package manager instructions
macOS Arm64 I x64
Widnows x64 I x86
All dotnet-install scripts

2. You have installed Azure Functions Core Tools v4.x

Azure Functions Core Tools lets you develop and test your functions on your local computer from the command prompt or terminal. Your local functions can connect to live Azure services, and you can debug your functions on your local computer using the full Functions runtime.

⚠️ Note
Don't mix local development with portal development in the same function app. When you create and publish functions from a local project, you won't be able to maintain or modify project code in the portal.

3. Local storage emulator Azurite

During local development, you can use the local Azurite emulator when testing functions with Azure Storage bindings, without having to connect to remote storage services. Azurite integrates with Visual Studio Code and Visual Studio, and you can also run it from the command prompt using npm. For more information, see Use the Azurite emulator for local Azure Storage development.

The following setting in the Values collection of the local.settings.json file tells the local Functions host to use Azurite for the default AzureWebJobsStorage connection:

"AzureWebJobsStorage": "UseDevelopmentStorage=true"

Installing & Running

Follow these steps to get your development environment set up and running locally

1. Clone the repository

Clone the repository using SSH.

git clone [email protected]:prepaidtech/dash-api.git

Set up personal SSH keys on Windows | Bitbucket Cloud

Clone the repository using HTTPS.

git clone https://<your-profile-name>@bitbucket.org/prepaidtech/dash-api.git

2. Navigate to the project directory

cd <project-name>

3. Install the dependencies

Run below command to restore all the necessary dependencies and packages for the project.

dotnet restore

4. Configuration Files

A Functions project directory contains the following files and folders, regardless of language:

local.settings.json
Settings used by Core Tools when running locally, including app settings. To learn more, see local settings.

{
    "IsEncrypted": false,
    "Values" : {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "MyConnection": "<connection-string-to-your-databse>",
        "MyOptions:Option1": "value",
        "MyOptions:Option2": "value"
    },
    "ConnectionStrings": {
        "DefaultConnection": "UseDevelopmentStorage=true"
    } 
}

host.json
The global configuration file host.json includes settings that affect all functions deployed under the same function app. To learn more, see the host.json reference.

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            } 
        } 
    } 
}

5. Run the project

We have 5 .NET Azure Function Apps in our solution.

Dash.Api.Audits.Functions
Dash.Api.Cards.Functions
Dash.Api.Payments.Functions
Dash.Api.Users.Functions
Dash.Api.Webhooks.Functions

Navigate to the project directory you want it to be running.
Using the following command to Start the Azure Functions runtime host.

func start

⚠️ Note
Make sure you have host.json and local.settings.json files and those are configured properly before running the Function App.


If the Function App is running correctly, you can see similar screen on the console. Azure Function App

Test with Postman

Postman is a standalone software testing API platform to build, test, design, modify, and document APIs.

You can see OpenAPI definitions here for Function Apps.

dash-api\Dash.Terraform\modules

Once you have Function App up and running, you can import the OpenAPI definitions into Postman to test them out.

e.g. Dash Cards API

dash-api\Dash.Terraform\modules\cards-service\open-api-cards.yaml

Postman Collection


⚠️ Note
Make sure you are using Postman Desktop Agent

Contributing to Project

To contribute to <Project Name>, follow these steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project>/<location>
  5. Create the pull request.

Alternatively see the Bitbucket documentation on creating a pull request.

food-lookup-demo-rails's People

Contributors

xmas7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.