Skip to content

Commit

Permalink
fix: public
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jan 26, 2024
1 parent e58a6ac commit d030702
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions public/test.html
@@ -0,0 +1 @@
<!-- Testing automatic serving of files from the 'public/' directory -->
2 changes: 1 addition & 1 deletion src/app.test.ts
Expand Up @@ -67,7 +67,7 @@ await test('createApp', async (t) => {
const arr: Test[] = [
// Static
{ method: 'GET', url: '/', statusCode: 200 },
{ method: 'GET', url: '/output.css', statusCode: 200 },
{ method: 'GET', url: '/test.html', statusCode: 200 },
{ method: 'GET', url: `/${file}`, statusCode: 200 },

// CORS
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Expand Up @@ -31,7 +31,7 @@ export function createApp(db: Low<Data>, options: AppOptions = {}) {
const app = new App()

// Static files
app.use(sirv(join(__dirname, '../public'), { dev: !isProduction }))
app.use(sirv('public', { dev: !isProduction }))
options.static
?.map((path) => (isAbsolute(path) ? path : join(process.cwd(), path)))
.forEach((dir) => app.use(sirv(dir, { dev: !isProduction })))
Expand Down

0 comments on commit d030702

Please sign in to comment.