https://github.com/softonic/hapi-static-files
Hapi plugin to serve static files with CORS enabled and maximum cache time.
https://github.com/softonic/hapi-static-files
Last synced: about 1 year ago
JSON representation
Hapi plugin to serve static files with CORS enabled and maximum cache time.
- Host: GitHub
- URL: https://github.com/softonic/hapi-static-files
- Owner: softonic
- License: other
- Created: 2016-11-13T12:09:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T03:31:15.000Z (over 3 years ago)
- Last Synced: 2025-03-15T04:36:29.759Z (about 1 year ago)
- Language: JavaScript
- Size: 938 KB
- Stars: 0
- Watchers: 19
- Forks: 2
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hapi-static-files
Hapi plugin to serve static files with CORS enabled and maximum cache time.
## Installation
```bash
npm install @softonic/hapi-static-files
```
## Usage
```javascript
// CommonJS
// const HapiStaticFiles = require('@softonic/hapi-static-files');
// ES6
import HapiStaticFiles from '@softonic/hapi-static-files';
// Registration
await server.register({
plugin: HapiStaticFiles,
options: {
path: 'public' // Absolute path or relative to the root folder of the project.
}
});
```
## Testing
Clone the repository and execute:
```bash
npm test
```
## Contribute
1. Fork it: `git clone https://github.com/softonic/hapi-static-files.git`
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Added some feature'`
4. Check the build: `npm run build`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D