Skip to content

Commit 364d853

Browse files
authored
Merge pull request #49 from langchain-ai/dqbd/internal-endpoints-reorder
fix(api): ensure that the internal endpoints are at the top
2 parents bd63a97 + 8dddc75 commit 364d853

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

libs/langgraph-api/src/server.mts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,6 @@ export async function startServer(options: z.infer<typeof StartServerSchema>) {
8080
// Loopback fetch used by webhooks and custom routes
8181
bindLoopbackFetch(app);
8282

83-
if (options.auth?.path) {
84-
logger.info(`Loading auth from ${options.auth.path}`);
85-
await registerAuth(options.auth, { cwd: options.cwd });
86-
app.use(auth());
87-
}
88-
89-
if (options.http?.app) {
90-
logger.info(`Loading HTTP app from ${options.http.app}`);
91-
const { api } = await registerHttp(options.http.app, { cwd: options.cwd });
92-
app.route("/", api);
93-
}
94-
95-
app.use(cors(options.http?.cors));
96-
app.use(requestLogger());
97-
app.use(ensureContentType());
98-
9983
app.post(
10084
"/internal/truncate",
10185
zValidator(
@@ -117,6 +101,22 @@ export async function startServer(options: z.infer<typeof StartServerSchema>) {
117101
},
118102
);
119103

104+
if (options.auth?.path) {
105+
logger.info(`Loading auth from ${options.auth.path}`);
106+
await registerAuth(options.auth, { cwd: options.cwd });
107+
app.use(auth());
108+
}
109+
110+
if (options.http?.app) {
111+
logger.info(`Loading HTTP app from ${options.http.app}`);
112+
const { api } = await registerHttp(options.http.app, { cwd: options.cwd });
113+
app.route("/", api);
114+
}
115+
116+
app.use(cors(options.http?.cors));
117+
app.use(requestLogger());
118+
app.use(ensureContentType());
119+
120120
if (!options.http?.disable_meta) app.route("/", meta);
121121
if (!options.http?.disable_assistants) app.route("/", assistants);
122122
if (!options.http?.disable_runs) app.route("/", runs);

0 commit comments

Comments
 (0)