From c035bfec8a767269e2cff14186dc1374283010fa Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Wed, 31 Jul 2024 20:42:17 -0400 Subject: [PATCH] Add the static assets directory and serve it. --- src/assets/main.css | 2 -- src/index.tsx | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) delete mode 100644 src/assets/main.css diff --git a/src/assets/main.css b/src/assets/main.css deleted file mode 100644 index fdcf84e..0000000 --- a/src/assets/main.css +++ /dev/null @@ -1,2 +0,0 @@ -/* Do something */ - diff --git a/src/index.tsx b/src/index.tsx index 4c7528f..89832f1 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -29,7 +29,12 @@ app.get( ) ); -app.get('/static/*', serveStatic({ root: "./assets/" })); +app.use('/static/*', serveStatic({ + root: '/src/assets', + onNotFound: (path, c) => { + console.error(`${path} is not found; Trying to access ${c.req.path}`); + } +})); console.log(JSON.stringify({ message: "Bootstrapping the routes..." })); app.route('/', home);