-
Notifications
You must be signed in to change notification settings - Fork 2
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
nilay nath sharan
committed
Oct 22, 2023
1 parent
ad9f8a5
commit 5c6e493
Showing
14 changed files
with
636 additions
and
188 deletions.
There are no files selected for viewing
Empty file.
Empty file.
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,11 @@ | ||
--- | ||
title: 'HumanTD' | ||
slug: humantd | ||
publishedAt: '2023-06-08' | ||
description: 'Portal that tracks down a person of interest by using backtracking and video footage from CCTV cameras.' | ||
banner: 'nilaysharan/project/humantd/qwlr8aaqfn7xwb1dazqr' | ||
tags: 'react,tailwindcss,typescript' | ||
github: 'github.com/nilaysharan/humantd' | ||
--- | ||
|
||
sabdakbsdj |
Empty file.
Empty file.
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,28 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
import { getFileBySlug, preFetch } from '@/lib/mdx.server'; | ||
|
||
export async function GET(req: NextRequest) { | ||
const BASE_URL = `${req.nextUrl.origin}/api/projects/`; | ||
const url = new URL(req.url || '', BASE_URL); | ||
|
||
const slug = url.pathname.split('/').pop() || ''; | ||
|
||
if (!slug) return new NextResponse(null, { status: 404 }); | ||
|
||
try { | ||
const preRoutes = preFetch({ type: 'projects' }); | ||
const preRoute = preRoutes?.find((route) => route.slug === slug); | ||
const file = await getFileBySlug( | ||
preRoute?.source as string, | ||
preRoute?.slug as string | ||
); | ||
|
||
if (!file) | ||
return new NextResponse(null, { status: 404, statusText: 'Not found ' }); | ||
|
||
return NextResponse.json(file); | ||
} catch (error) { | ||
return NextResponse.json({ error: error }); | ||
} | ||
} |
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
Oops, something went wrong.