Skip to content

Commit

Permalink
Merge pull request #24 from gitit-emkoo/feature/#22
Browse files Browse the repository at this point in the history
[구은모] feat: getCompanies API 구현
  • Loading branch information
gitit-emkoo authored Jan 6, 2025
2 parents ae10166 + 6175230 commit 60afba0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import getCompanies_ksh from './src/routes/getCompanies_ksh.js';
import createInvestment_ksh from './src/routes/createInvestment_ksh.js';
import patchInvestment_ksh from './src/routes/patchInvestment_ksh.js';
import deleteInvestment_ksh from './src/routes/deleteInvestment_ksh.js';
import getConmpanies_Kem from './src/routes/getCompanies_Kem.js';

dotenv.config();
export const app = express();
Expand Down Expand Up @@ -64,4 +65,7 @@ app.use('/api/kjy', getCompanyDetail_kjy);
// 해당 기업에 투자한 투자자 목록 조회(김주영)
app.use('/api/kjy', getInvesterList_kjy);

// 기업 목록 조회(구은모)
app.use('/api/kem', getConmpanies_Kem);

app.listen(process.env.PORT || 5500, () => console.log('Server Started'));
5 changes: 5 additions & 0 deletions src/http/companies_kem.http
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
19 changes: 19 additions & 0 deletions src/routes/getCompanies_Kem.js
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;

0 comments on commit 60afba0

Please sign in to comment.