This file contains hidden or 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
Show hidden characters
| { | |
| "compilerOptions": { | |
| "baseUrl": ".", | |
| "paths": { | |
| "@/components/*": ["components/*"], | |
| "@/data/*": ["data/*"], | |
| "@/layouts/*": ["layouts/*"], | |
| "@/lib/*": ["lib/*"], | |
| "@/utils/*": ["utils/*"], | |
| "@/styles/*": ["styles/*"], |
This file contains hidden or 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
| git clone --depth=1 git://github.com/luigircruz/example-repo.git |
This file contains hidden or 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
| import { getNowPlaying } from '../../lib/spotify' | |
| export default async (_, res) => { | |
| const response = await getNowPlaying() | |
| if (response.status === 204 || response.status > 400) { | |
| return res.status(200).json({ isPlaying: false }) | |
| } | |
| const song = await response.json() |
This file contains hidden or 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
| import { getTopTracks } from '../../lib/spotify' | |
| export default async (_, res) => { | |
| const response = await getTopTracks() | |
| const { items } = await response.json() | |
| const tracks = items.slice(0, 10).map((track) => ({ | |
| artist: track.artists.map((_artist) => _artist.name).join(', '), | |
| songUrl: track.external_urls.spotify, | |
| title: track.name, |
This file contains hidden or 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
| import querystring from 'querystring' | |
| const client_id = process.env.SPOTIFY_CLIENT_ID | |
| const client_secret = process.env.SPOTIFY_CLIENT_SECRET | |
| const refresh_token = process.env.SPOTIFY_REFRESH_TOKEN | |
| const basic = Buffer.from(`${client_id}:${client_secret}`).toString('base64') | |
| const NOW_PLAYING_ENDPOINT = `https://api.spotify.com/v1/me/player/currently-playing` | |
| const TOP_TRACKS_ENDPOINT = `https://api.spotify.com/v1/me/top/tracks` | |
| const TOKEN_ENDPOINT = `https://accounts.spotify.com/api/token` |
This file contains hidden or 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
| const NOW_PLAYING_ENDPOINT = `https://api.spotify.com/v1/me/player/currently-playing` | |
| export const getNowPlaying = async () => { | |
| const { access_token } = await getAccessToken() | |
| return fetch(NOW_PLAYING_ENDPOINT, { | |
| headers: { | |
| Authorization: `Bearer ${access_token}`, | |
| }, | |
| }) |
This file contains hidden or 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
| const TOP_TRACKS_ENDPOINT = `https://api.spotify.com/v1/me/top/tracks` | |
| export const getTopTracks = async () => { | |
| const { access_token } = await getAccessToken() | |
| return fetch(TOP_TRACKS_ENDPOINT, { | |
| headers: { | |
| Authorization: `Bearer ${access_token}`, | |
| }, | |
| }) |
This file contains hidden or 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
| import querystring from 'querystring' | |
| const client_id = process.env.SPOTIFY_CLIENT_ID | |
| const client_secret = process.env.SPOTIFY_CLIENT_SECRET | |
| const refresh_token = process.env.SPOTIFY_REFRESH_TOKEN | |
| const basic = Buffer.from(`${client_id}:${client_secret}`).toString('base64') | |
| const TOKEN_ENDPOINT = `https://accounts.spotify.com/api/token` | |
| const getAccessToken = async () => { |
This file contains hidden or 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
| GlobalExecutionContext = { | |
| LexicalEnvironment : { | |
| EnvironmentRecord : { | |
| DeclarativeEnvironmentRecord: { | |
| input: "Hello, World!", | |
| broadcast: { | |
| LocalExecutionContext : { | |
| LexicalEnvironment : { | |
| EnvironmentRecord: { | |
| DeclarativeEnvironmentRecord: { |
This file contains hidden or 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
| GlobalExecutionContext = { | |
| LexicalEnvironment : { | |
| EnvironmentRecord : { | |
| DeclarativeEnvironmentRecord : { | |
| input: <uninitialized>, | |
| broadcast: < function broadcast(message) { | |
| return `${name} says ${message}`; | |
| } >, | |
| }, // Bindings of identifier to variables (`let` and `const`) and identifier to function objects | |
| ObjectEnvironmentRecord : { |