bunsvr/router

Default mime types

Paul-Browne opened this issue · 4 comments

Is there a way to pass a default, or array of default mime types? Eg. something like...

import { Router } from '@stricjs/router';
import { dir } from '@stricjs/utils';

export default new Router()
  .get('/*', dir('./public/'), {
    extensions: ["html"]
  });

So that f.ex. localhost:3000/batman would resolve to /public/batman.html

@Paul-Browne This serve static will get the file type because it uses Bun.file under the hood.

I will add something for that use case
maybe an option for php and html idk
@Paul-Browne what do you think the API should be

aquapi commented

@Paul-Browne group will be better for this use case

aquapi commented

image
@Paul-Browne
This is a part of the code with @stricjs/utils@1.5.5
That group will search for files in pages and serve them.
But if the extension is .html it adds another route
Also with sth like /index.html it will add another / route