-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[구은모] feat: getCompanies API 구현
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
GET http://localhost:5500/api/kem/companies | ||
|
||
### | ||
|
||
GET http://localhost:5500/api/jhm/companies |
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,19 @@ | ||
//구은모 | ||
|
||
import express from 'express'; | ||
import { PrismaClient } from '@prisma/client'; | ||
import asyncHandler from '../controllers/asyncHandler.js'; | ||
import { convertToBigIntFromObjArray } from '../controllers/convertToBigIntFromObjArray.js'; | ||
|
||
const router = express.Router(); | ||
const prisma = new PrismaClient(); | ||
|
||
router.get( | ||
'/api/kem/companies', | ||
asyncHandler(async (req, res) => { | ||
const companies = await prisma.company.findMany(); | ||
res.send(convertToBigIntFromObjArray(companies)); | ||
}) | ||
); | ||
|
||
export default router; |