#endpoint with dot not crated during build time

2 messages · Page 1 of 1 (latest)

tawdry cairnBOT
#

Hi @silent scaffold. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the information provided in the extracts, Astro allows you to create custom endpoints by adding a .js or .ts file to the /pages directory. The .js or .ts extension will be removed during the build process, so the name of the file should include the extension of the data you want to create. For example, src/pages/data.json.ts will build a /data.json endpoint.

However, the extracts do not provide specific information on how to handle files that start with a dot, such as .htaccess. It's possible that Astro's build process may not support this directly due to the special handling of dotfiles in Unix-based systems.

Your current workaround of creating htaccess.ts and renaming it to .htaccess after the build seems to be a practical solution given the constraints.

For more detailed guidance or potential alternatives, you may want to refer to the Astro documentation (https://docs.astro.build) or consider opening an issue on the Astro GitHub page (https://github.com/withastro/astro/issues) to get input from the Astro community.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: