forked from CaliCastle/cali.so
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add newsletter signup in footer
- Loading branch information
1 parent
35ee8e0
commit 6238044
Showing
5 changed files
with
358 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { sql } from 'drizzle-orm' | ||
import { NextResponse } from 'next/server' | ||
|
||
import { db } from '~/db' | ||
|
||
export async function GET() { | ||
const { | ||
rows: [count], | ||
} = await db.execute( | ||
sql`SELECT | ||
(SELECT COUNT(*) FROM subscribers WHERE subscribed_at IS NOT NULL) as subscribers` | ||
) | ||
|
||
if (typeof count !== 'undefined' && 'subscribers' in count) { | ||
return NextResponse.json({ | ||
count: count.subscribers, | ||
}) | ||
} | ||
|
||
return NextResponse.error() | ||
} | ||
|
||
export const runtime = 'edge' | ||
export const revalidate = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.