parent
0e90d53b8e
commit
74ef38cdb6
6 changed files with 222 additions and 54 deletions
@ -0,0 +1,92 @@ |
|||||||
|
[ |
||||||
|
{ |
||||||
|
"title": "Transport Protocols: TCP vs UDP", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "OSI Model Explained", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "Creating a React App", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "DOM vs Shadow DOM vs Virtual DOM", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "Everything you need to know about HTTP Caching", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "Content Delivery Networks", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "Load Balancers in Depth", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "DNS and How does it Work?", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"title": "JavaScript Fetch API", |
||||||
|
"description": "Learn the basics of CI/CD and how to implement that with GitHub Actions.", |
||||||
|
"url": "/watch/transport-protocols-tcp-vs-udp", |
||||||
|
"fileName": "tcp-udp", |
||||||
|
"isPro": false, |
||||||
|
"duration": "10 minutes", |
||||||
|
"updatedAt": "2020-07-09T19:59:14.191Z", |
||||||
|
"createdAt": "2020-07-09T19:59:14.191Z" |
||||||
|
} |
||||||
|
] |
@ -0,0 +1,14 @@ |
|||||||
|
import authors from '../content/authors.json'; |
||||||
|
|
||||||
|
export type AuthorType = { |
||||||
|
username: string; |
||||||
|
name: string; |
||||||
|
twitter: string; |
||||||
|
picture: string; |
||||||
|
bio: string; |
||||||
|
} |
||||||
|
|
||||||
|
export function findAuthorByUsername(username: string): AuthorType | undefined { |
||||||
|
return (authors as AuthorType[]).find(author => author.username === username); |
||||||
|
} |
||||||
|
|
@ -0,0 +1,44 @@ |
|||||||
|
import videos from '../content/videos.json'; |
||||||
|
import formatDate from 'date-fns/format'; |
||||||
|
import { NextApiRequest } from 'next'; |
||||||
|
|
||||||
|
export type VideoType = { |
||||||
|
title: string; |
||||||
|
description: string; |
||||||
|
url: string; |
||||||
|
fileName: string; |
||||||
|
isPro: boolean; |
||||||
|
duration: string; |
||||||
|
createdAt: string; |
||||||
|
updatedAt: string; |
||||||
|
formattedCreatedAt: string; |
||||||
|
formattedUpdatedAt: string; |
||||||
|
}; |
||||||
|
|
||||||
|
export function getAllVideos(limit: number = 0): VideoType[] { |
||||||
|
return (videos as VideoType[]) |
||||||
|
.sort((a, b) => (new Date(b.updatedAt) as any) - (new Date(a.updatedAt) as any)) |
||||||
|
.map(video => ({ |
||||||
|
...video, |
||||||
|
formattedCreatedAt: formatDate(new Date(video.createdAt), 'MMMM d, yyyy'), |
||||||
|
formattedUpdatedAt: formatDate(new Date(video.updatedAt), 'MMMM d, yyyy') |
||||||
|
})) |
||||||
|
.slice(0, limit ? limit : videos.length); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
export function getRequestedGuide(req: NextApiRequest): VideoType | undefined { |
||||||
|
const allVideos = getAllVideos(); |
||||||
|
const video = allVideos.find(video => video.url === req.url); |
||||||
|
if (!video) { |
||||||
|
return undefined; |
||||||
|
} |
||||||
|
|
||||||
|
try { |
||||||
|
return video; |
||||||
|
} catch (e) { |
||||||
|
console.log(e); |
||||||
|
} |
||||||
|
|
||||||
|
return undefined; |
||||||
|
} |
Loading…
Reference in new issue