Add stand alone needle-tiny-storage example to samples

I have been trying to get a needle-tiny-storage project running so I can use the dropListener and give it a fastify/needle-tiny-storage url to use during local development, but it’s not clear how to set it up.

I have a stand alone node app running now with fastify, but beyond that I’m not sure how to add the required needle packages and what code to add to server.js (or wherever) to make it work with the droplistener.

With fastify alone, I get errors about the /exists throwing a 404 so I obviously need something more.

Original Post on Discord

by user 563549194137239552

All you need for local dev is basically the same that the template on glitch does minus the deployment, analytics and networking setup. So:

Install "@needle-tools/needle-tiny-storage": "^1.1.2-pre"

And then do this in the server setup:

import storage from "@needle-tools/needle-tiny-storage";
storage.initFastify(fastify, { registerPlugins: true });

Thats what is used when you deploy to glitch and click “create a remix” button

The types dont exist. The storage module is written in vanilla js. I think you might need to modify your tsconfig to allow impicit any or to skip checking types for installed packages maybe?

When do you get the error?

OK. My confusion is because if you just go to Glitch and grab what is there it has none of the needle stuff in it. It is pure .js . I had to create a NT project and deploy it to Glitch in order for it to have typescript, storage, etc in it. When you said ‘the template on Glitch’ I was assuming the blank template on Glitch and not the Needle Tools glitch template

by user 563549194137239552

Sorry for the confusion, definitely an area that we should document better. But yes, “the Needle Tools glitch starter” and not “some random glitch starter” contain our packages :wink:

when I get it working I will post step by step instructions

by user 563549194137239552