The project is generated by LoopBack.
It is basically a demo for the loopback-secure-storage component developped by the same author.
Just clone the repository, then run npm i
inside and you're done.
Start the project with npm start
, the API explorer webpage will open directly.
Note: The swagger is started at server initialisation for documentation purpose, but you might want to use Postman instead for instance (mostly for createFile
and downloadFile
), or even Curl! 😎
curl --location --request GET 'http://localhost:3000/api/SecretDocuments/1234/downloadFile' > test.pdf
The example shows a container to store PDF in a secure way, using the SecureStorage component with AES-128 encryption.
Available routes:
-
/api/SecretDocuments
: will return the list of the stored documents -
/api/SecretDocuments/createFile
will attempt to upload the given file and store it as a encrypted file using thestorage.json
config file -
/api/SecretDocuments/{documentId}/downloadFile
: will try to download the given document -
/api/SecretDocuments/{documentId}/deleteFile
: will try to delete the stored document and it database entry
Great! Then feel free to run npm i loopback-secure-storage
in your own project and you're good to go.
You can find additionnal information on the component's GitHub repository