UNPKG
shop
Version:
latest (1.0.0)
1.0.0
github.com/Olymposbr/shop
Olymposbr/shop
shop
/
services
/
mongodb.ts
9 lines
(6 loc)
•
252 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
import
{
MongoClient
}
from
'mongodb'
const
connectionString = process.
env
.
MONGODB_CONNECTIONSTRING
if
(!connectionString) {
throw
new
Error
(
'MONGODB_CONNECTIONSTRING is not defined'
) }
export
const
mongodb =
new
MongoClient
(connectionString).
db
()