
This means that the application is working. Now, when you switch back to the terminal where the server is running, you will see these requests in the server logs. Open a new terminal and run the following curl commands: We will POST some JSON to the API and then make a GET request to see that the data has been saved. Open your terminal and go to the working directory you created. Now let’s test the application and make sure it’s working. You can also make GET requests at the same endpoint and receive JSON objects that you have previously POSTed. Any JSON structure sent to the server will be saved.


You can now make POST requests to the root (/) endpoint. The mocking server will listen on port 8000 by default. In your IDE, open the working directory, and on the server.js file, add the following code. We will use a mock server called ronin.js for this. Once the REST API is created, we can add some code to handle our REST requests. Now create a simple REST API using the following steps. On your local machine, create a directory named node-docker. Now that we have enabled BuildKit, let’s create a simple Docker Node.js application. In case the daemon.json file doesn’t exist on your system, create a new file called daemon.json and then add the following command to the file: If you want to enable docker BuildKit by default, you need to set the daemon configuration in /etc/docker/daemon.json feature to ‘true’. To set the BuildKit environment variable when running the docker build command, run:

If you do not have Docker Desktop installed, you will have to manually enable BuildKit. On the Docker Desktop, It is enabled by default for all users.
