-
Basic CRUD Functionality. You should be able to:
- Create inventory items
- Edit Them
- Delete Them
- View a list of them
-
Along with one additional feature:
- Allow image uploads AND store image with generated thumbnails
- First create a Firebase Project
- Go to your Firebase project Dashboard and click on storage in the build tab. Once you have initialized your firebase storage, inside the storage menu there will be a tab called Rules, where you would have to change the following line:
allow read, write: if request.auth != null;
to
allow read, write: if request.auth == null;
- Generate an serviceAccountkey for your firebase project. Go to your
Firebase project -> Project Settings -> Service Accounts
and download the firebase SDK by clickingGenerate New Private Key
button - Rename the file to
serviceAccountKey.json
and put it in the root folder. The file will look like this
{
"type": ,
"project_id": ,
"private_key_id": ,
"private_key": ,
"client_email": ,
"client_id": ,
"auth_uri": ,
"token_uri": ,
"auth_provider_x509_cert_url": ,
"client_x509_cert_url":
}
- Create a
.env
file and enter your create a variable called BUCKET_URL and store your firebase bucket url
BUCKET_URL=YOUR_BUCKET_URL
- To install all the dependencies run
npm i
- Please also run this command
brew install GraphicsMagick
- To run the application, start up your terminal /command prompt ,and go to the project folder and then run the following command
node index.js
-
All the inventry items are stored in the Firebase Database
-
Create inventory items : POST {/api/inventory/add}
- Sample body request:
{ "item" : "sanitizer", "qunatity" : 4 }
-
View inventory : GET {/api/inventory/view}
-
Edit inventory item : PUT {/api/inventory/edit}
- Sample body request:
{ "item" : "sanitizer", "qunatity" : 9 }
-
Delete inventory item : DELETE {/api/inventory/delete/$item_name}
-
Once images are uploaded, a thumbnail is generated which is then stored in the Firebase Storage that can be later downloaded using the download url genrated by Firebase
-
Upload Image and store the generated thumnbnail: POST {/api/image/upload}
- Sample body request:
{ "file" : test2.png }
-
Image Download : GET {/api/images/download}
- The file's download url is generated using firebase
- Security during download:
- The download url is an unique url generated by firebase
- Since we have made some chnages in the security rules of the firesbase storage,any body for now can download the images
- Sample body request:
{ "imageName" : test2.png }
- Make the UI interface for the app
- Update the create inventory request so that it accepts images as well.
- If required I will migrate to aws or gcp in the future releases.
- Currently the create inventory request only accepts two body parameters which are
item name
andquantity
, if required i can update it and store more metadata such as expirty date, product_condition,shipment date,etc
Email : [email protected]