Giter VIP home page Giter VIP logo

shopify-backend-task's Introduction

Shopify Backend Task

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

Additional Task: Export product data to a CSV file

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 = 1000
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
npm run startmon //for dev

App engine deployed service

Deployed service [shopify-backend-task] to https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com

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/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order
Sample Output: 
[
    {
        "_id": "61e18952b302444400f16e1c",
        "item_name": "item_name1",
        "delivery_address": "Some Address A",
        "storage_facilty_address": "Some Address B",
        "active": true,
        "order_type": "For Delivery",
        "createdAt": "2022-01-14T14:31:46.720Z",
        "updatedAt": "2022-01-14T14:31:46.720Z",
        "__v": 0
    },
    {
        "_id": "61e18982528f9ddadd202786",
        "item_name": "item_name2",
        "delivery_address": "Some Address A",
        "storage_facilty_address": "Some Address B",
        "active": true,
        "order_type": "For Delivery",
        "createdAt": "2022-01-14T14:32:34.243Z",
        "updatedAt": "2022-01-14T14:32:34.243Z",
        "__v": 0
    },
]
  • Create an order item
POST/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order
Request body:
{
    "item_name": "some item",
    "delivery_address": "some address",
    "storage_facilty_address": "some storage facility address",
    "active": "true"
}
Sample Output:
{
    "order": {
        "item_name": "some item 10",
        "delivery_address": "Atwater Ave",
        "storage_facilty_address": "some address",
        "active": true,
        "_id": "61e7e1cbd5ea97ddbab32f72",
        "order_type": "For Delivery",
        "tracking_id": "61e7e1cbd5ea97ddbab32f71"
    }
}
  • Delete an order item
DELETE/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order/{{order_id}}
Sample Output:
{
   message: "Order successfully deleted!",
}
  • Update an order item
PUT/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order/{{order_id}}
// Include only the fields which needs to be updated in the request body.
Request Body:
{
    "item_name": "updated item_name info",
    "delivery_address": "updated some address info",
    "storage_facilty_address": "updated some storage facility address",
}
Sample Output:
{
    "order": {
        "item_name": "updated item_name info",
        "delivery_address": "updated some address info",
        "storage_facilty_address": "updated some storage facility address",
        "active": true,
        "_id": "61e7e1cbd5ea97ddbab32f72",
        "order_type": "For Delivery",
        "tracking_id": "61e7e1cbd5ea97ddbab32f71"
    }
}
  • Get one order item
GET/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order/{{order_id}}
Sample Output:
{
    "order": {
        "item_name": "some item 10",
        "delivery_address": "Atwater Ave",
        "storage_facilty_address": "some address",
        "active": true,
        "_id": "61e7e1cbd5ea97ddbab32f72",
        "order_type": "For Delivery",
        "tracking_id": "61e7e1cbd5ea97ddbab32f71"
    }
}
  • Export information to a CSV File
GET/ https://shopify-backend-task-dot-voomp-landing.el.r.appspot.com/developer/order/export/csv
// Make sure to use 'save & download' button to download the CSV file in postman
Sample Output
{
    "message": "Successfully Exported to export.csv!"
}

License

MIT

shopify-backend-task's People

Contributors

ganmol123 avatar

Watchers

James Cloos 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.