ItzNotABug / appexpress

An express.js like framework for Appwrite Functions, enabling super-easy navigation!
Apache License 2.0
43 stars 4 forks source link

Feat: Allow Direct Access to Public Content #10

Closed ItzNotABug closed 5 months ago

ItzNotABug commented 5 months ago

This PR adds the ability to serve static contents, the logic is configurable as well.

Example -

  1. File structure -
    public -
        .env
        robots.txt
        app-ads.txt
  2. Add the directory -
    express.static('public');

This will serve files in the public directory directly when you do - https://function.com/robots.txt.

Excluding some files not meant for public -

You can also exclude some files, like the .env file in the public directory with either name or a regex -

express.static('public', [/^\..*env.*/i, 'config.php']);
ItzNotABug commented 5 months ago

Base branch used was #view-engine-support.