-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
77 additions
and
15 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
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
import { RequestHandler } from 'express'; | ||
import { HbsViewProps } from '../interfaces/hbs-view-props.interface'; | ||
import { SITE_TITLE, SPOTIFY_ICON_PATH } from '../utils/constant.util'; | ||
import { getFullUrl, getUrl } from '../utils/url.util'; | ||
|
||
export const card_index: RequestHandler = (_req, res) => { | ||
res.render('card/index.view.hbs'); | ||
export const card_index: RequestHandler = (req, res) => { | ||
const siteUrl = getUrl(req); | ||
const pageUrl = getFullUrl(req); | ||
const props: HbsViewProps = { | ||
pageTitle: `Card View - ${SITE_TITLE}`, | ||
pageDescription: "View someone's Spotify data.", | ||
pageUrl, | ||
siteImage: siteUrl + SPOTIFY_ICON_PATH | ||
}; | ||
res.render('card/index.view.hbs', { ...props }); | ||
}; |
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
import { RequestHandler } from 'express'; | ||
import { HbsViewProps } from '../interfaces/hbs-view-props.interface'; | ||
import { SITE_TITLE, SPOTIFY_ICON_PATH } from '../utils/constant.util'; | ||
import { getFullUrl, getUrl } from '../utils/url.util'; | ||
|
||
export const index: RequestHandler = (_req, res) => { | ||
res.render('home/index.view.hbs'); | ||
export const index: RequestHandler = (req, res) => { | ||
const siteUrl = getUrl(req); | ||
const pageUrl = getFullUrl(req); | ||
const props: HbsViewProps = { | ||
pageTitle: SITE_TITLE, | ||
pageDescription: 'Share your music taste with the world.', | ||
pageUrl, | ||
siteImage: siteUrl + SPOTIFY_ICON_PATH | ||
}; | ||
res.render('home/index.view.hbs', { ...props }); | ||
}; |
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,6 @@ | ||
export interface HbsViewProps { | ||
pageTitle: string; | ||
pageDescription: string; | ||
pageUrl: string; | ||
siteImage: string; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
// config | ||
export const CLIENT_ID = process.env.SPOTIFY_CLIENT_ID!; | ||
export const CLIENT_SECRET = process.env.SPOTIFY_CLIENT_SECRET!; | ||
export const MONGODB_URI = process.env.MONGODB_CONNECTION_STRING!; | ||
export const REDIS_URI = process.env.REDIS_CONNECTION_STRING!; | ||
export const PORT = process.env.PORT || 8080; | ||
|
||
// other constants | ||
export const SITE_TITLE = 'Spotify Data Card'; | ||
export const SHORT_URL = 'iodev.io/s-d-c'; | ||
export const SPOTIFY_WHITE_LOGO_PATH = '/images/Spotify_Logo_RGB_White.png'; | ||
export const SPOTIFY_ICON_PATH = '/images/Spotify_Icon_RGB_Green.png'; |
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