Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miserylee/oss-serve
Serve static web pages on Aliyun OSS.
https://github.com/miserylee/oss-serve
Last synced: 24 days ago
JSON representation
Serve static web pages on Aliyun OSS.
- Host: GitHub
- URL: https://github.com/miserylee/oss-serve
- Owner: miserylee
- License: other
- Created: 2016-10-01T08:27:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-09T13:33:07.000Z (almost 7 years ago)
- Last Synced: 2024-11-01T00:12:37.455Z (2 months ago)
- Language: TypeScript
- Size: 35.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## oss-serve ![NPM version](https://img.shields.io/npm/v/oss-serve.svg?style=flat)
### Installation
```bash
$ yarn add -D oss-serve
```### Example
```js
const Serve = require('oss-serve');const serve = new Serve({
oss: {
accessKeyId: /* Your AccessKeyID */,
accessKeySecret: /* Your AccessKeySecret */,
bucket: /* Your bucket name */,
region: /* Your bucket region */
},
destination: /* Which subdir the bucket you want to serve to */,
baseUrl: /* The domain you have bind to the bucket */
});serve.push(path.resolve(__dirname, 'dist'));
serve.pull(path.resolve(__dirname, 'backup'));// or by cli just set settings in root of project named `oss-serve.config.json` and then run the command.
$ oss-serve
```### API
#### Serve(options);
##### options
* oss {object} ali-oss options. Check more details [here](https://github.com/ali-sdk/ali-oss#ossoptions)!
* [destination] {string} The subdir of the bucket where to serve the files, if not set means to
serve pages at the root of the bucket.
* [baseUrl] {string} The custom domain bind to the bucket, If not set, default oss domain will be used. Check more details [here](https://github.com/ali-sdk/ali-oss#getobjecturlname-baseurl)!#### serve.push(root);
Update the remote files by local files;* root {string} The root path of local files;
#### serve.pull(root);
Update the local files by remote files;* root {string} The root path of local folder;