mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-11-30 17:17:55 +08:00
feat: depoly on now serverless function (#4554)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,3 +15,5 @@ tmp
|
|||||||
*.iml
|
*.iml
|
||||||
coverage
|
coverage
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
.now
|
||||||
10
api/now.js
Normal file
10
api/now.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const moduleAlias = require('module-alias');
|
||||||
|
moduleAlias.addAlias('@', path.join(__dirname, '../lib'));
|
||||||
|
const logger = require('@/utils/logger');
|
||||||
|
logger.clear();
|
||||||
|
const s = require('@/app.js').callback();
|
||||||
|
|
||||||
|
module.exports = (req, res) => {
|
||||||
|
s(req, res);
|
||||||
|
};
|
||||||
@@ -263,6 +263,10 @@ env_variables:
|
|||||||
# [END app_yaml]
|
# [END app_yaml]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Deploy to Vercel(Zeit Now)
|
||||||
|
|
||||||
|
Project export a now serverless function with a `now.json` configuration,After installing[Vercel(Zeit Now)](https://vercel.com/docs/now-cli),just run `now` in project directory, RSSHub is on now serverless function.
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
Under RSSHub's root directory, execute the following commands to launch RSSHub
|
Under RSSHub's root directory, execute the following commands to launch RSSHub
|
||||||
|
|||||||
@@ -267,6 +267,10 @@ env_variables:
|
|||||||
# [END app_yaml]
|
# [END app_yaml]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 部署至 Vercel(Zeit Now)
|
||||||
|
|
||||||
|
项目中导出了 now serverless function 并附带 `now.json`相关配置,安装了[Vercel(Zeit Now)](https://vercel.com/docs/now-cli)之后,只需要在项目中运行`now` 即可部署到 Now 的云函数上。
|
||||||
|
|
||||||
### 安装
|
### 安装
|
||||||
|
|
||||||
在 RSSHub 项目根目录下运行
|
在 RSSHub 项目根目录下运行
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const { resolve } = require('path');
|
||||||
const winston = require('winston');
|
const winston = require('winston');
|
||||||
const config = require('@/config').value;
|
const config = require('@/config').value;
|
||||||
|
|
||||||
@@ -10,10 +11,10 @@ const logger = winston.createLogger({
|
|||||||
// - Write all logs error (and below) to `error.log`.
|
// - Write all logs error (and below) to `error.log`.
|
||||||
//
|
//
|
||||||
new winston.transports.File({
|
new winston.transports.File({
|
||||||
filename: 'logs/error.log',
|
filename: resolve('logs/error.log'),
|
||||||
level: 'error',
|
level: 'error',
|
||||||
}),
|
}),
|
||||||
new winston.transports.File({ filename: 'logs/combined.log' }),
|
new winston.transports.File({ filename: resolve('logs/combined.log') }),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user