Skip to content

Contains the code for runnig the buyer mock server using buyer-mock-config

Notifications You must be signed in to change notification settings

ONDC-Official/buyer-mock-engine

Repository files navigation

Introduction

The Buyer Mock Engine is a Node.js server that handles the business logic required by the protocol server. It serves data to the frontend of the protocol server and also connects to the protocol server for data exchange.

Repository Structure

  • src/
  • config/
  • .env-sample
  • Readme.md

Change Log

This is the version 0.0.1 of the buyer mock engine

Contribution

Contributions can be made using the following branching structure:

    Branches: master -> Integ -> feat/fix/feature

Dependency

  • Sandbox-UI
  • Protocol Server

Pre-requisite

  • Node.js
  • git
  • npm

Submodules intialization

  • Initialize submodules
git submodule
  • Updates submodules to the specific commit that is recorded in the main repository’s current commit
git submodule update
  • Updates the submodule to the latest commit on the branch specified in the .gitmodules file.
git submodule update --remote --merge

Conifuration

The buyer mock engine depends on configs to run. Different configs can be used to run buyer mock enigne for diffenent use cases.

Buyer mock engine can consume these configs in 2 differnt ways

Local configs

  • To use the configs from local, the config repo is used as a submodule inside the buyer mock engine repo and the configs are imported by the buyer mock engine.

  • First initialize the submodule.

Follow initialization of submodule.

  • Change the following env varaibales
    LOAD_LOCAL_CONFIG = true
    CONFIG_FILE_NAME = "fis_build.json"
  • LOAD_LOCAL_CONFIG acts as a boolean flag and CONFIG_FILE_NAME can be found inside the config submodule's build folder.

Github configs.

  • To use github configs, the url of the raw file with configs is porvided to the buyer mock engine, and it fetches the data from it.

  • Change the folllowing env vaiables.

    LOAD_LOCAL_CONFIG = false
    CONFIG_URL = "https://raw.githubusercontent.com/ONDC-Official/buyer-mock-config/master/build/fis_build.json"
  • LOAD_LOCAL_CONFIG acts as a boolean flag

  • The CONFIG_URL can be found by navigating to the file containing the config file inside build folder in the github repo.

  • Click the raw button.

Screenshot 2024-09-13 at 8 35 08 AM
  • Now copy the url of the raw file.

How to run - local

  • Install dependencies
npm i
  • Create a .env file with the provided .env-sample file
  • Run the application
npm run dev

About

Contains the code for runnig the buyer mock server using buyer-mock-config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •