MongoDB ๋ฐ Next.js๋กœ ๐Ÿ—๏ธ๋‚ด ์ฒซ ๋ฒˆ์งธ ๐Ÿ—„๏ธAPI๋ฅผ ์–ด๋–ป๊ฒŒ ๊ตฌ์ถ•ํ–ˆ์Šต๋‹ˆ๊นŒ?

5245 ๋‹จ์–ด mongodbnextjsapinode
๊ทธ๊ฑด ๊ทธ๋ ‡๊ณ , ์ €๋Š” ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์ž์ž…๋‹ˆ๋‹ค๐Ÿง‘๐Ÿฟโ€๐Ÿ’ป, ์ €๋Š” ํ•ญ์ƒ API๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์ž‘์—…ํ•˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•ฉ๋‹ˆ๋‹ค.
๊ทธ๋Ÿฐ๋ฐ ์ œ๊ฐ€ API๋ฅผ ๋งŒ๋“ค๊ณ  ์‹ถ์—ˆ๋˜ ํ”„๋กœ์ ํŠธ๊ฐ€ ์• ํ”Œ์˜ ๐ŸŽ ์Šคํ† ์–ด์ฒ˜๋Ÿผ,
API๋ฅผ ๊ตฌ์ถ•ํ•˜๊ณ  ์ถœ์‹œํ•˜๊ฒ ๋‹ค๋Š” ์˜์ง€๋ฅผ ๊ฐ–๊ฒŒ ๋˜์—ˆ๊ณ ,
๋ช‡ ์ฃผ ์ „์— ์ €๋Š” **Firebase **๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ ์‚ฌ์šฉํ–ˆ๋˜ ๋กœ ์ž‘์—…์„ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ ์ง€๊ธˆ์€ ๋‚˜ ์ž์‹ ์„ ๋ฐ€์–ด๋ถ™์ด๊ณ  **MongoDB **๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ์—ˆ์Šต๋‹ˆ๋‹ค.

์ž ์‹œ ์ƒ๊ฐํ•œ ํ›„ ํ”„๋กœ์ ํŠธ ๊ฑด๋ฌผ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

์˜คํ”ˆ ์†Œ์Šค Apple Store API.



Next.js API Routes ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ฐฑ์—”๋“œ๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ๊ฐ€ ๋งค์šฐ ์‰ฌ์›Œ์กŒ์Šต๋‹ˆ๋‹ค.
๋‚˜๋Š” ๊ฐ„๋‹จํ•œ ๋ผ์šฐํŒ…๊ณผ ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค์–ด์„œ ์ด ํŽ˜์ด์ง€์— ์˜ค๋ฉด ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ์™€ ํ•จ๊ป˜ ์ œ๊ณต๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
BaseUrl : https://oas.vercel.app/api

/๋ชจ๋‘



baseUrl /all

it provides all the data from the database, from all the categories without filteration. ๐Ÿ˜Š


/์นดํ…Œ๊ณ ๋ฆฌ/:์นดํ…Œ๊ณ ๋ฆฌ



baseurl /category/iphone





here you can add category for your output. and result will be from that category only.
example: + /category/watch
+ /category/iphone
+ /category/macbook
+ /category/airpods
+ /category/ipad


/์‹œ๋ฆฌ์ฆˆ/:์‹œ๋ฆฌ์ฆˆ



baseurl /series/MacBook Air
๐Ÿง‘โ€๐Ÿ’ปevery product has series name such as iPhone 13 has series name such as iPhone 13, under iPhone 13 two products come iPhone 13 & iPhone 13 mini.

They are case sentitive ๐Ÿ˜“ so iphone_13, iPhone_13 won't work โŒ,
correct way /series/iPhone 13 โœ…
without %20

/:_ID

baseurl /6228d7ac2e00fb1164b2df27





for getting results realted to single product the /:_Id is used.
example: /6228d7ac2e00fb1164b2df27,
these are id sentitive fetch with their respective id's.๐Ÿ˜…



{
    "data": {
        "_id": "6228d7ac2e00fb1164b2df27",
        "product_name": "MacBook Pro",
        "product_price": {
            "IN": 109000,
            "US": 999,
            "GBP": 899
    },
    "product_description": "Id culpa aliquip ipsum excepteur sunt incididunt laboris magna incididunt nostrud.",
}
}




์ด๊ฒƒ์ด ์ œ๊ฐ€ ๋ผ์šฐํŒ…/ ๋ฐ ์š”์ฒญ์— ๋Œ€ํ•ด ๐Ÿ’ช๐Ÿพ ์ž‘์—…ํ•œ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.



์ด ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์–ด๋• ๋Š”์ง€ ์•Œ๋ ค์ฃผ์„ธ์š”. ์ถ”์ฒœ ์„น์…˜์—์„œ ๊ท€ํ•˜์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์•Œ๋ ค๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ณต์œ  ๐Ÿค๐Ÿพ ๋‹น์‹ ์˜ ์•„์ด๋””์–ด ์ƒ๊ฐ์ด ์ด๊ฒƒ์— ๊ด€ํ•œ ๋‚˜๋Š” ๊ทธ๊ฒƒ์„ ๊ตฌํ˜„ํ•˜๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค.





์— ์—ฐ๊ฒฐ
ํŠธ์œ„ํ„ฐ :
Github : @theabhayprajapati
๐Ÿ‘‹๐Ÿพ

์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ