Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重构为typescript #69

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion node-proxy/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
RUN_MODE=DEV
RUN_MODE=DEV
LOG_LEVEL=debug
5 changes: 2 additions & 3 deletions node-proxy/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ module.exports = {

function prettierrc() {
const prettierrc_id = require.resolve('./.prettierrc')
var stat = fs.statSync(prettierrc_id)
const stat = fs.statSync(prettierrc_id)
if (stat.mtimeMs > (process.prettierrc_file_mtimeMs || 0)) {
process.prettierrc_file_mtimeMs = stat.mtimeMs
require.cache[prettierrc_id] = undefined
}
const conf = require('./.prettierrc')
return conf
return require('./.prettierrc')
}
344 changes: 0 additions & 344 deletions node-proxy/app.js

This file was deleted.

31 changes: 31 additions & 0 deletions node-proxy/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import path from 'path'
import http from 'http'

import Koa from 'koa'

import { port } from '@/config'
import { logger } from '@/common/logger'
import alisRouter from '@/router/alist'
import otherRouter from '@/router/other'
import webdavRouter from '@/router/webdav'
import staticRouter from '@/router/static'
import webuiRouter from '@/router/webui'
import { exceptionMiddleware, loggerMiddleware } from './src/utils/middlewares'

const app = new Koa()

app.use(loggerMiddleware)
app.use(exceptionMiddleware)
app.use(alisRouter.routes())
app.use(webuiRouter.routes())
app.use(webdavRouter.routes())
app.use(staticRouter.routes())
app.use(otherRouter.routes())

const server = http.createServer(app.callback())
server.maxConnections = 1000
server.listen(port, () => logger.info('服务启动成功: ' + port))

setInterval(() => {
logger.debug('server_connections', server.connections, Date.now())
}, 600 * 1000)
Loading
Loading