1.0.7 • Published 4 years ago

@studiowebux/static v1.0.7

Weekly downloads
3
License
SEE LICENSE IN li...
Repository
github
Last release
4 years ago

Webux Static

This module uses express to serve static files

Installation

Linux

npm i --save @studiowebux/static

Windows

npm i --save @studiowebux/static

Mac

npm i --save @studiowebux/static

Usage

Provide an array of path and local directory (Key/Value), the module will automatically serve those paths for external access.

Configurations

Note You must load the static resources after the API routes to avoid issues.

config/static.js

module.exports = {
  resources: [
    { path: "/api", resource: "./api" },
    { path: "/assets", resource: "./assets" }
  ]
};

Function

KeyDescriptionMandatory
options(Default: {}) The resources to exposeYes
app(Default: None) The express applicationYes
express(Default: None) The express objectYes
log(Default: Console) If a custom logger is requiredNo

serveStatic function returns a Promise,

serveStatic(options, app, express, log);

Example

For examples, check the /examples directory

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

SEE LICENSE IN license.txt

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago