-
Hi, I am trying query database in getStaticProps, it worked ok. But I wonder can connection string run on client too? :\
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Hey @warcraft14115 . The best approach would be to create an API route that fetches this data for you. This API route will then run the server-side logic, and fetch and return the data.This way you don't have to expose your connection string or send the MongoDB code to the client. You can do this inside If you need more help, I'd be happy to write some example code or create a pull request! |
Beta Was this translation helpful? Give feedback.
-
#12970 (reply in thread) |
Beta Was this translation helpful? Give feedback.
#12970 (reply in thread)
Answer here.