1 min read

How to generate BFC API from Template

In this section we will explain how to generate an initial version of the BFC API from the Template. We will use our Sfcc powered BFC API for most of the examples.

Prerequisites

  • Githug access in order to obtain an API Template project. In this specific example we are working against Poq github, otherwise “BFC API Template” will be provided to you and you will need to use your org's github to store the code.
  • .NET Core 5.0 SDK and later versions

Steps

  1. Checkout the latest version of the NetCoreWebApiOcapiBackendForClient template (Sfcc BFC template). All templates are located under https://github.com/poqcommerce/Poq.ApiTemplate repo.
  2. Install the template using a command line. Example: dotnet new -i "/Users/andrei/Documents/GitHub/Poq/Poq.ApiTemplate/NetCoreWebApiOcapiBackendForClient"

Template install
Template install

  1. Execute template. Example: dotnet new poqapiocapibfctemplate --name Poq.Api.YourBrand -o "/Users/andrei/Documents/GitHub/Poq/Poq.Backend.Yourbrand"

Code generation using template
Code generation using template

  1. Once executed, the full BFC API will be created from the template. Template will also add the rest of the required files to the folder such as:
    1. .editorconfig
    2. NuGet.config
    3. PULL_REQUEST_TEMPLATE.md
    4. README.md

Generated files
Generated files

  1. Launch Poq.Api.YourBrand.sln solution and build it.

Solution screen
Solution screen

  1. Run unit tests.

Unit tests
Unit tests

Congratulations, you have successfully generated a BFC API from the BFC API Template.
You may have noticed that Integration.Tests have failed. This is expected. You need to apply proper local configuration before they start working as expected. Checkout next steps for further information.

See Next