From 919ac7012aca3d12e3a35da4201dcfd1f39c2dc3 Mon Sep 17 00:00:00 2001 From: Guillaume Dorce Date: Thu, 3 Nov 2022 17:34:35 +0100 Subject: [PATCH] fix order in express --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index a36b2b6..cb05d1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,8 @@ app.use(urlencoded({ extended: true, limit: '50mb' })); app.use(express.static(path.join(__dirname, '../public'))); +app.use('/api', api); + // check if folder dist-vite exists if (fs.existsSync(path.join(__dirname, '../client/dist-vite'))) { app.use(express.static(path.join(__dirname, '../client/dist-vite'))); @@ -51,8 +53,6 @@ if (fs.existsSync(path.join(__dirname, '../client/dist-vite'))) { app.use(express.static(path.join(__dirname, '../client/dist'))); } -app.use('/api', api); - app.listen(port, () => { console.log(`Server listening on port ${port}`); });