Accessing assets directory from "http-server" package


#1

Hi,

First off thank you so much for glitch its amazing and i would recommand it to all my fellow developers!

To my question, you allow 512MB of file storage in assets directory.

  1. I wanted to know how i can through code upload files to that directory.
  2. access these files from the “http-server” package, since i just need a serve to serve static files (without creating my own express server)

thanks!

Arye.


#2

Hello @pantchox

These files are hosted on Glitch’s CDN. Each of your assets has a COPY URL button that you can press. Copy it and paste it into your project.


#3

Hi,

thanks for your reply, i am aware of that, my question was how do i put files in the assets directory through code, not through the online editor.

Eventually my solution was a bit different,
in my package.json file i run “http-server” and also my “index.js” script where “http-server” is installed globally.

so what i did i saved my files (through code) to “/tmp” directory and in the package.json when i start “http-server” i added the path directory to be “/tmp” so now i can serve and write from/to the “/tmp” directory.

assets is nice as a CDN solution but its not quick and dirty solution as i needed.

thanks for your help.