Skip to content

Latest commit

 

History

History
153 lines (144 loc) · 4.72 KB

File metadata and controls

153 lines (144 loc) · 4.72 KB

Remote development with VScode

Remote Development

Create public ssh keypair on local machine

ssh-keygen -t rsa -b 4096

Connect to remote from VScode

Setting up a python project

Create directory for project

mkdir projectA
cd projectA

Create python virtual environment

virtual environment

python3 -m venv venv

Activate the python virtual environment

. ./venv/bin/activate

TASKS

Sample Product Catalog

Implement a product-catalog service using the python fast API library. The product-catalog service should read product items from a json file (as includes) to memory.

The product-service should implement a http API to read and search products as:

http://product-catalog/products/search?desc={$desc}
http://product-catalog/products/read?id={$id}

products.json

{
    "products": [
        {
            "id": "OLJCESPC7Z",
            "name": "Sunglasses",
            "description": "Add a modern touch to your outfits with these sleek aviator sunglasses.",
            "picture": "/static/img/products/sunglasses.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 19,
                "nanos": 990000000
            },
            "categories": ["accessories"]
        },
        {
            "id": "66VCHSJNUP",
            "name": "Tank Top",
            "description": "Perfectly cropped cotton tank, with a scooped neckline.",
            "picture": "/static/img/products/tank-top.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 18,
                "nanos": 990000000
            },
            "categories": ["clothing", "tops"]
        },
        {
            "id": "1YMWWN1N4O",
            "name": "Watch",
            "description": "This gold-tone stainless steel watch will work with most of your outfits.",
            "picture": "/static/img/products/watch.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 109,
                "nanos": 990000000
            },
            "categories": ["accessories"]
        },
        {
            "id": "L9ECAV7KIM",
            "name": "Loafers",
            "description": "A neat addition to your summer wardrobe.",
            "picture": "/static/img/products/loafers.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 89,
                "nanos": 990000000
            },
            "categories": ["footwear"]
        },
        {
            "id": "2ZYFJ3GM2N",
            "name": "Hairdryer",
            "description": "This lightweight hairdryer has 3 heat and speed settings. It's perfect for travel.",
            "picture": "/static/img/products/hairdryer.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 24,
                "nanos": 990000000
            },
            "categories": ["hair", "beauty"]
        },
        {
            "id": "0PUK6V6EV0",
            "name": "Candle Holder",
            "description": "This small but intricate candle holder is an excellent gift.",
            "picture": "/static/img/products/candle-holder.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 18,
                "nanos": 990000000
            },
            "categories": ["decor", "home"]
        },
        {
            "id": "LS4PSXUNUM",
            "name": "Salt & Pepper Shakers",
            "description": "Add some flavor to your kitchen.",
            "picture": "/static/img/products/salt-and-pepper-shakers.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 18,
                "nanos": 490000000
            },
            "categories": ["kitchen"]
        },
        {
            "id": "9SIQT8TOJO",
            "name": "Bamboo Glass Jar",
            "description": "This bamboo glass jar can hold 57 oz (1.7 l) and is perfect for any kitchen.",
            "picture": "/static/img/products/bamboo-glass-jar.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 5,
                "nanos": 490000000
            },
            "categories": ["kitchen"]
        },
        {
            "id": "6E92ZMYYFZ",
            "name": "Mug",
            "description": "A simple mug with a mustard interior.",
            "picture": "/static/img/products/mug.jpg",
            "priceUsd": {
                "currencyCode": "USD",
                "units": 8,
                "nanos": 990000000
            },
            "categories": ["kitchen"]
        }
    ]
}