-
Notifications
You must be signed in to change notification settings - Fork 1
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
9 changed files
with
54 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { connectDb } from '@/libs/connect-db' | ||
import { Project } from '@/models/project-schema' | ||
|
||
export const getProjects = async () => { | ||
await connectDb() | ||
const data = await Project.find() | ||
return data | ||
} |
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 @@ | ||
import { NextRequest } from 'next/server' | ||
import { getProjects } from './getProjects' | ||
|
||
export async function GET(request: NextRequest) { | ||
try { | ||
const data = await getProjects() | ||
return Response.json({ data }) | ||
} catch (error) { | ||
return Response.json({ error }, { status: 500 }) | ||
} | ||
} |
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
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,13 @@ | ||
const API_END_POINT = `${process.env.NEXT_PUBLIC_BASE_URL}` | ||
|
||
export const getAllMembers = async () => { | ||
const res = await fetch(`${API_END_POINT}/api/people`) | ||
const { data } = await res.json() | ||
return data | ||
} | ||
|
||
export const getAllProjects = async () => { | ||
const res = await fetch(`${API_END_POINT}/api/project`) | ||
const { data } = await res.json() | ||
return data | ||
} |
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,14 @@ | ||
import mongoose, { Schema } from 'mongoose' | ||
|
||
export const ProjectSchema = new Schema({ | ||
_id: String, | ||
description: String, | ||
github: String, | ||
imageUrl: String, | ||
member: String, | ||
project: String, | ||
team: String | ||
}) | ||
|
||
export const Project = | ||
mongoose.models.Project ?? mongoose.model('Project', ProjectSchema) |