Skip to content

ls12342/mktp-api

Repository files navigation

Marketplace API

This is a marketplace API management

Installation

Use the node package manager npm to install dependencies and run the project. After the installation just run the following command on your terminal.

npm i

Running

To start the application just run the following command.

npm run start

This will start application at: http://localhost:4000

Testing

npm run test

This will run all the tests

Dabatse

The database is postgres as a service [elephantsql] (https://www.elephantsql.com/), theres no initial configuration to be done. All the conection handling is inside the project (/src/infrastructure/database)

Usage

This API uses graphQL, you should be able execute query and mutations at: http://localhost:4000/graphql These are the mutations and querys you can use:

query {
  getProducts {
    id
    name
    enabled
    price
    storeId
  }

  getPurchases {
    userPaid
    storeAmount
    mktAmount
    paymentSystemAmount
    storeId
    product {
      name
      price
      enabled
    }
  }
}

mutation {
  buyProduct(productid: 1) {
    userPaid
    storeAmount
    mktAmount
    paymentSystemAmount
    storeId
    productid
  }
  newStore(store: { name: "test", fee: 50 }) {
    id
    name
    fee
  }

  editStore(store: { fee: 4 }, storeId: 3)

  newProduct(
    product: { name: "testProduct", price: 100, storeId: 1, enabled: true }
  ) {
    id
    name
    price
    storeId
    enabled
  }

  editProduct(
    product: { name: "tfp", price: 1, storeId: 1, enabled: true }
    productid: 13
  )

  removeProduct(productid: 14)
}


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published