This module provides shortcut routes for accessing glimpse functionality and user authentication.
- GET
/login
- User-specific login redirect with auto-registration - GET
/thanks
- New user welcome page - GET
/:id
- Get page data by ID (equivalent to/views/glimpse/:id
)
- Requires user authentication via
authCheck
middleware - Same authentication requirements as the original
/views/glimpse/:id
route
Provides personalized redirect functionality for authenticated users with automatic user registration.
- User must be authenticated (Google OAuth via LastLogin)
- System extracts user's email from authentication context
- Queries
GLANCE_DEMOS_DB_ID
database for user's record - If user found: Extracts redirect URL and redirects to personal URL
- If user not found: Creates new user record and redirects to
/thanks
The GLANCE_DEMOS_DB_ID
database must contain:
- Email property: User's email address (exact match with authenticated email)
- URL property: User's redirect URL (optional for new users)
- Property names:
URL
,Link
,Redirect URL
,Demo URL
,url
,link
- Property types:
url
,rich_text
,title
- User creation fails: Shows access denied HTML page with technical details
- Missing URL: Returns JSON error with debugging information
- Invalid URL: Returns JSON error with validation details
- Database errors: Returns JSON error with technical details
GLANCE_DEMOS_DB_ID
- Required Notion database ID for user lookup
Welcome page for newly registered users explaining next steps.
- Confirms successful account creation
- Shows user's registered email address
- Explains admin review process
- Provides timeline expectations (1-2 business days)
- Includes support contact information
- Requires authentication (redirects to dashboard if not authenticated)
- Typically accessed via redirect from
/login
after user creation
id
(string, required) - The Notion page ID to retrieve
Returns JSON response with page data from Notion API, with button properties filtered out.
When serving the React frontend, initial data is injected into the HTML to avoid loading states. To prevent HTML content from Notion pages (like <script>
tags or other HTML elements) from breaking the JavaScript bootstrapping process, all <
characters in the JSON data are escaped using Unicode escape sequences (\u003c
). This ensures that any HTML tags in Notion content are safely rendered as text rather than executed as HTML.
This module provides multiple access patterns:
- Auto-registration:
/glimpse/login
- Personalized user redirect with automatic signup - Welcome flow:
/glimpse/thanks
- New user onboarding - Data access:
/glimpse/{page-id}
- Shortcut to/views/glimpse/{page-id}
The login route transforms the user experience from "access denied" to "welcome, you're registered" for new users.