Skip to content

How to handle serving of static files #61

@EskelCz

Description

@EskelCz

Hi, I love this project.
One thing I can't figure out though is how to (in addition to javascript routes) also serve image files. The router doesn't seem to recognize them. Maybe I'm doing something wrong but I can't find anything in the documentation about it. Is this supported?
Thanks.

For reference I'm using this basic setup:

import https from 'https'
import { initFileRouter } from 'node-file-router'

const useFileRouter = await initFileRouter({
  baseDir: 'src/routes'
})

async function handleRequest (req, res) {
  await useFileRouter(req, res)
}

https.createServer(options, handleRequest).listen(env.PORT)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions