Skip to content

Commit

Permalink
chore: add comments to explain functionality #5
Browse files Browse the repository at this point in the history
  • Loading branch information
shah committed Sep 24, 2024
1 parent 2b22975 commit 1dfc9ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/lib/[...slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export async function getStaticPaths() {
// Check if the slug ends with `.sql.*` and add another endpoint which is the generic or Deno execution result of the sql.ts file
if (/\.sql\..*$/.test(relativePath)) {
const slug = `/${relativePath.replace(/\.sql\..*$/, '.sql')}`;
// if the file is executable, capture the output as SQL
if(stat.mode & fsConsts.S_IXUSR) {
endpoints.push({
params: { slug },
Expand All @@ -108,6 +109,8 @@ export async function getStaticPaths() {
},
})
} else if (relativePath.endsWith('.ts')) {
// if the file is not executable but is a `.sql.ts` file, use Deno to execute it
// and capture the output as SQL
endpoints.push({
params: { slug },
props: {
Expand Down

0 comments on commit 1dfc9ce

Please sign in to comment.