mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: experimental hot reload support
This commit is contained in:
1 parent
632ae27b88
commit
fd7c9cbeb1
26 files changed
+429
-148
No files matched your search
@@ -2,7 +2,7 @@ import { makeExecutableSchema } from '@graphql-tools/schema';
|
||||
import { graphql, GraphQLSchema } from 'graphql';
|
||||
import { resolvers, typeDefs } from 'graphql-scalars';
|
||||
import * as bus from '../service/bus';
|
||||
import { Handler, Route } from '../service/server';
|
||||
import { Handler } from '../service/server';
|
||||
|
||||
const types: Record<string, Record<string, string>> = {};
|
||||
const unions: Record<string, string> = {};
|
||||
@@ -123,8 +123,7 @@ class ApiHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
export function apply() {
|
||||
Route('api', '/api', ApiHandler);
|
||||
export const sideEffect = true;
|
||||
export function apply(ctx) {
|
||||
ctx.Route('api', '/api', ApiHandler);
|
||||
}
|
||||
|
||||
global.Hydro.handler.api = apply;
|
||||
@@ -119,11 +119,9 @@ class BlogEditHandler extends BlogHandler {
|
||||
}
|
||||
}
|
||||
|
||||
export async function apply() {
|
||||
Route('blog_main', '/blog/:uid', BlogUserHandler);
|
||||
Route('blog_create', '/blog/:uid/create', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
|
||||
Route('blog_detail', '/blog/:uid/:did', BlogDetailHandler);
|
||||
Route('blog_edit', '/blog/:uid/:did/edit', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
|
||||
export async function apply(ctx) {
|
||||
ctx.Route('blog_main', '/blog/:uid', BlogUserHandler);
|
||||
ctx.Route('blog_create', '/blog/:uid/create', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
|
||||
ctx.Route('blog_detail', '/blog/:uid/:did', BlogDetailHandler);
|
||||
ctx.Route('blog_edit', '/blog/:uid/:did/edit', BlogEditHandler, PRIV.PRIV_USER_PROFILE);
|
||||
}
|
||||
|
||||
global.Hydro.handler.blog = apply;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Handler, Route } from '../service/server';
|
||||
import { Handler } from '../service/server';
|
||||
|
||||
class ProblemCategoryCompatHandler extends Handler {
|
||||
async get({ category }) {
|
||||
@@ -6,6 +6,6 @@ class ProblemCategoryCompatHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
global.Hydro.handler.compat = () => {
|
||||
Route('problem_category_compat', '/p/category/:category', ProblemCategoryCompatHandler);
|
||||
export const apply = (ctx) => {
|
||||
ctx.Route('problem_category_compat', '/p/category/:category', ProblemCategoryCompatHandler);
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
import './home';
|
||||
import './problem';
|
||||
import './record';
|
||||
import './judge';
|
||||
import './user';
|
||||
import './contest';
|
||||
import './training';
|
||||
import './discussion';
|
||||
import './manage';
|
||||
import './import';
|
||||
import './misc';
|
||||
import './homework';
|
||||
import './domain';
|
||||
import './status';
|
||||
import './api';
|
||||
import './blog';
|
||||
import './compat';
|
||||
@@ -1,26 +0,0 @@
|
||||
/* eslint-disable no-empty-function */
|
||||
/* eslint-disable class-methods-use-this */
|
||||
import { NotFoundError } from '../error';
|
||||
import {
|
||||
Handler, param, Route, Types,
|
||||
} from '../service/server';
|
||||
|
||||
class NotFoundHandler extends Handler {
|
||||
@param('bsod', Types.Boolean)
|
||||
prepare(domainId: string, bsod: boolean) {
|
||||
if (bsod) throw new Error(this.request.path);
|
||||
throw new NotFoundError(this.request.path);
|
||||
}
|
||||
|
||||
get() { }
|
||||
post() { }
|
||||
head() { }
|
||||
put() { }
|
||||
delete() { }
|
||||
}
|
||||
|
||||
export async function apply() {
|
||||
Route('notfound', '(/.*)+', NotFoundHandler);
|
||||
}
|
||||
|
||||
global.Hydro.handler.notfound = apply;
|
||||
Reference in new issue
Block a user