![]() A service in Compose is a running container, and service definitions - which you will include in your docker-compose.yml file - contain information about how each container image will run. With your code refactored, you are ready to write the docker-compose.yml file with your service definitions. Step 4 - Defining Services with Docker Compose With this code in place, you can move on to defining your services with Compose. You have now added resiliency to your application code to handle cases where your application might fail to connect to your database. Save and close the file when you have finished editing. ~/node_project/db.js const mongoose = require('mongoose') Currently, these constants look like this: Our first step in modifying the file will be redefining the constants that include sensitive information. Connects to the database using the nnect method.įor more information about the file, please see Step 3 of How To Integrate MongoDB with Your Node Application.Sets the database credentials as constants, including the username and password. ![]() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |