mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-02-23 03:53:00 +08:00
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import express from '@/vendor/express';
|
|
import $ from '@/core/app';
|
|
|
|
import registerSubscriptionRoutes from './subscriptions';
|
|
import registerCollectionRoutes from './collections';
|
|
import registerArtifactRoutes from './artifacts';
|
|
import registerFileRoutes from './file';
|
|
import registerModuleRoutes from './module';
|
|
import registerSyncRoutes from './sync';
|
|
import registerDownloadRoutes from './download';
|
|
import registerSettingRoutes from './settings';
|
|
import registerPreviewRoutes from './preview';
|
|
import registerSortingRoutes from './sort';
|
|
import registerMiscRoutes from './miscs';
|
|
import registerNodeInfoRoutes from './node-info';
|
|
|
|
export default function serve() {
|
|
let port;
|
|
let host;
|
|
if ($.env.isNode) {
|
|
port = eval('process.env.SUB_STORE_BACKEND_API_PORT');
|
|
host = eval('process.env.SUB_STORE_BACKEND_API_HOST');
|
|
}
|
|
const $app = express({ substore: $, port, host });
|
|
// register routes
|
|
registerCollectionRoutes($app);
|
|
registerSubscriptionRoutes($app);
|
|
registerDownloadRoutes($app);
|
|
registerPreviewRoutes($app);
|
|
registerSortingRoutes($app);
|
|
registerSettingRoutes($app);
|
|
registerArtifactRoutes($app);
|
|
registerFileRoutes($app);
|
|
registerModuleRoutes($app);
|
|
registerSyncRoutes($app);
|
|
registerNodeInfoRoutes($app);
|
|
registerMiscRoutes($app);
|
|
|
|
$app.start();
|
|
}
|