Setting Up a NodeJS Web Server On Your Android Phone or Tablet
Tags: node, android
Published: 2019-11-07 19:32:06

---
title: Setting Up a NodeJS Web Server On Your Android Phone or Tablet
published: true
description: Setting Up a NodeJS Web Server On Your Android Phone or Tablet
tags: nodejs,android
canonical_url: https://www.codewall.co.uk/setting-up-a-nodejs-web-server-on-your-android-phone-or-tablet
---

I came across a really cool app recently, specifically on my Samsung Galaxy S9 Android device. The app is called Dory and it’s capable of installing a full-working NodeJS environment on your device.

In this article, I will detail how to get your very first NodeJS web server setup on your device and ultimately connect to a web page locally. It won’t take longer than 10 minutes, so just for the cool factor, it’s well worth the time spent.

### Step 1

1.  Open the Google Play Store on your device and search for ‘Dory’, see Figure 1 so that you know what it looks like when you see it. Alternatively hit the following link – [Dory – Node.JS](https://play.google.com/store/apps/details?id=io.tempage.dorynode&hl=en)
2.  Hit the install button and await the app to finish downloading and installing.

![dory app](https://www.codewall.co.uk/wp-content/uploads/2019/04/dory-nodejs.jpg)

Figure 1. Dory NodeJS – Play Store Listing

### Step 2

1.  Locate the app on your device and launch it.
2.  As the app launches you will see a notification at the bottom, informing you of both Node and NPM installing.
3.  After this, another notification will inform you that they have been installed.
4.  Next, the NodeJS server will boot automatically, you can see this in the notification center, see Figure 2.

![nodejs running notification](https://www.codewall.co.uk/wp-content/uploads/2019/04/dory-nodejs-running.jpg)

Figure 2. NodeJS Running Notification

### Step 3

Time to write some code and serve our first page!



1.  Find the + icon at the bottom right of the app and tap it.
2.  Then, tap the ‘Eval Script’ button.
3.  Delete out the `console.log('hello world');` code.
4.  Add the following code block to the file –

**CodeBlock**

```javascript

    const http = require('http');
    
    let app = http.createServer((req, res) => {  
        // Set a response type of plain text for the response
        res.writeHead(200, {'Content-Type': 'text/plain'});
    
        // Send back a response and end the connection
        res.end('NodeJS Server Online!');
    });
    
    // Start the server on port 3000
    app.listen(3000, 'localhost');
```

### Step 4

1.  Goto the top right settings menu and use the ‘save as’ feature, save it as server.js in your documents folder.
2.  Navigate back to the home panel and make sure that the widget for the file is present and secondly make sure the ‘Start’ button is greyed out, meaning its active.
3.  If not, you can hit the + button, add file, and open the file from your documents folder.
4.  Now you can open up the browser, and navigate to http://localhost:3000
5.  See Figure 3, an example of my Chrome browser loading up the NodeJS Server.

![node js server online](https://www.codewall.co.uk/wp-content/uploads/2019/04/nodejs-server-online.jpg)

Figure 5. NodeJS Server Online

### Summary

This article shows you the basic instructions to get a NodeJS web server set up on your Android device. But, there are many other features this app offers too. The app comes fresh with NPM, has a file downloader and even has the ability to git clone! The app developers also have some other great applications ready for download as well, one of which is MongoDB, you can check them out [here](https://play.google.com/store/apps/collection/cluster?clp=igM4ChkKEzYwMTg3MzkwNTE5MjY4NDkyNzMQCBgDEhkKE2lvLnRlbXBhZ2UuZG9yeW5vZGUQARgDGAE%3D:S:ANO1ljKmRrU&gsr=CjuKAzgKGQoTNjAxODczOTA1MTkyNjg0OTI3MxAIGAMSGQoTaW8udGVtcGFnZS5kb3J5bm9kZRABGAMYAQ%3D%3D:S:ANO1ljLGLD0).



Cross Posted From : https://www.codewall.co.uk/