mirror of https://github.com/docker/docs.git
Add steps to start app in debug mode
Signed-off-by: Usha Mandya <usha.mandya@docker.com>
This commit is contained in:
parent
958dea68c0
commit
92b50927ea
|
@ -47,7 +47,7 @@ $ docker run -it --rm -d -v mongodb:/data/db \
|
|||
mongo
|
||||
```
|
||||
|
||||
Okay, now that we have a running mongodb, let’s update `server.js` to use a the MongoDB and not an in-memory data store.
|
||||
Okay, now that we have a running MongoDB, let’s update `server.js` to use MongoDB and not an in-memory data store.
|
||||
|
||||
```javascript
|
||||
const ronin = require( 'ronin-server' )
|
||||
|
@ -60,9 +60,9 @@ server.use( '/', mocks.server( server.Router(), false, false ) )
|
|||
server.start()
|
||||
```
|
||||
|
||||
We’ve add the ronin-database module and we updated the code to connect to the database and set the in-memory flag to false. We now need to rebuild our image so it contains our changes.
|
||||
We’ve add the `ronin-database` module and we updated the code to connect to the database and set the in-memory flag to false. We now need to rebuild our image so it contains our changes.
|
||||
|
||||
First let’s add the ronin-database module to our application using npm.
|
||||
First let’s add the `ronin-database` module to our application using npm.
|
||||
|
||||
```shell
|
||||
$ npm install ronin-database
|
||||
|
@ -142,9 +142,23 @@ volumes:
|
|||
|
||||
This Compose file is super convenient as we do not have to type all the parameters to pass to the `docker run` command. We can declaratively do that in the Compose file.
|
||||
|
||||
We are exposing port 9229 so that we can attach a debugger. We are also mapping our local source code into the running container so that we can make changes in our text editor and have those changes picked up in the container.
|
||||
We are exposing `port 9229` so that we can attach a debugger. We are also mapping our local source code into the running container so that we can make changes in our text editor and have those changes picked up in the container.
|
||||
|
||||
One other really cool feature of using a Compose file, is that we have service resolution set up to use the service names. So we are now able to use `“mongo”` in our connection string. The reason we use mongo is because that is what we have named our mongo service in the Compose file as.
|
||||
One other really cool feature of using a Compose file is that we have service resolution set up to use the service names. So we are now able to use `“mongo”` in our connection string. The reason we use mongo is because that is what we have named our MongoDB service in the Compose file as.
|
||||
|
||||
To start our application in debug mode, we need to add a line to our `package.json` file to tell npm how to start our application in debug mode.
|
||||
|
||||
Open the `package.json` file and add the following line to the scripts section:
|
||||
|
||||
```json
|
||||
"debug": "nodemon --inspect=0.0.0.0:9229 server.js"
|
||||
```
|
||||
|
||||
As you can see, we are going to use nodemon. Nodemon starts our server in debug mode and also watches for files that have changed, and restarts our server. Let’s add nodemon to our `package.json` file.
|
||||
|
||||
```json
|
||||
$ npm install nodemon
|
||||
```
|
||||
|
||||
To start our application in debug mode, we need to add a line to our `package.json` file to tell npm how to start our application in debug mode.
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ description: How to Build and Run your Tests using Node.js and Mocha frameworks
|
|||
|
||||
{% include_relative nav.html selected="4" %}
|
||||
|
||||
Testing is an essential part of modern software development. Testing can mean a lot of things to different development teams. There are unit tests, integration tests and end-to-end testing. In this guide we take a look at running your unit tests in Docker. Let's assume we have defined Mocha tests in a `/test` folder within our application.
|
||||
Testing is an essential part of modern software development. Testing can mean a lot of things to different development teams. There are unit tests, integration tests and end-to-end testing. In this guide we take a look at running your unit tests in Docker. Let's assume we have defined Mocha tests in a `./test` folder within our application.
|
||||
|
||||
### Running locally and testing the application
|
||||
|
||||
|
|
Loading…
Reference in New Issue