Giter VIP home page Giter VIP logo

shopify_challenge's Introduction

shopify_Backend_challenge

CRUD operations for an inventory tracking website as a part of Shopify Backend Task.

Framework used: Nodejs with Express

Local Deployment

Steps:

Environment Setup:

  • To see if you already have Node.js and npm installed and check the installed version, run the following commands:
node -v
npm -v
  • If you don't have Node.js and npm installed, use a node version manager to install Node.js and npm.

    OSX/Linux Node version manager: nvm, n

    Windows Node version manager: nodist, nvm-windows

    You can also use a Node installer: node.js installer

  • Clone the repository to the local system.
  • Create the .env file. The sample.env is as follows:
PORT = 5000
NODE_ENV = local
MONGODB_URI = mongdb_uri 

Starting the App

  • Run the below commands to install the dependencies and start the app.
npm install
npm run start

Testing

As frontend is not implemented please use POSTman or any REST API tester to test out the APIs.

Run in Postman

API Specification

  • Get all order items
GET/ http://localhost:5000/api/v1/items
Sample Output: 
[
    {
        "_id": "627ff805a81254f3740593b4",
        "name": "item10",
        "units": 10,
        "cost": 700,
        "__v": 0
    },
    {
        "_id": "627ff9c64c3840d4cc6c3d0d",
        "name": "item11",
        "units": 10,
        "cost": 700,
        "__v": 0
    },
    {
        "_id": "627ffa4aa7cbcae376c5cef9",
        "name": "item12",
        "units": 10,
        "cost": 700,
        "__v": 0
    }
 ]
  • Create an order item
POST/ http://localhost:5000/api/v1/item
Request body:
{  
  "name": "item 5",
  "units": 10,
  "cost": 700,
  "warehouse": "627fee2b586fc3270d34cb46"
}
{
    "name": "item 5",
    "warehouse": "627fee2b586fc3270d34cb46",
    "units": 10,
    "cost": 700,
    "_id": "6281dddaad7e5c4dc115fe1d",
    "__v": 0
}
  • Delete an order item
DELETE/ http://localhost:5000/api/v1/item/627ff9c64c3840d4cc6c3d0d
Sample Output:
{
    "message": "item with id 627ff9c64c3840d4cc6c3d0d has been successfully deleted"
}
  • Update an order item
PUT/ http://localhost:5000/api/v1/item/

Request Body:
{
   "name": "edited",
   "warehouse": "627fee2b586fc3270d34cb46",
   "units": 100,
   "cost": 70000
}
Sample Output:
{
    {
       "_id": "6281a920bcfd9e5bbb0a16d3",
       "name": "edited",
       "units": 100,
       "cost": 70000,
       "__v": 0,
       "warehouse": "627fee2b586fc3270d34cb46"
    }
}

shopify_challenge's People

Contributors

dee-d-dev avatar

Watchers

 avatar  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.