# Creating a Node.js project

### Creating a new folder

Let's start by creating a folder to organise our project. In the file explorer section, tap on the create folder button to create a new folder. Hold the folder cell and rename the folder. You can now assign as it as the workpalce folder.

![Assigning a folder as workplace folder](https://2795973332-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzNRZttJUHODcLjBFRZHP%2Fuploads%2FbbyQM96c9zITU3iVeeZX%2FIMG_0630.png?alt=media\&token=b0404d39-7e8b-41ed-8d00-839d42d63888)

### Installing npm modules

In this project, we will be using a third party npm module called `Express`. Install it by running `npm i express` in the terminal. You will now see a folder called `node_modules` that contains the module we just installed. Another file created is `package.json`, it stores the list of dependencies as well as other information of your project. You can learn more about npm here: <https://docs.npmjs.com/cli/v7/configuring-npm/package-json>

### Implementing the server

Creating a web server using Express is super simple. Create a new file `index.js` and copy the following code.

```javascript
const express = require('express');

const app = express();
const port = 3000;

app.get('/', (req, res) => {
    res.send('Hello from Express')
})

app.listen(port, () => console.log(`app listening on port ${port}`))
```

Tap the run button on type `node index.js` in the terminal to run the server. Launch Safari side-by-side and visit `localhost:3000`. You now have yourself an Express server :).

![An express server running on Code App](https://2795973332-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzNRZttJUHODcLjBFRZHP%2Fuploads%2FvnnP2xrRizpRll5YV1kM%2Fimage.png?alt=media\&token=529d4b8f-668f-437e-bb3a-2b19aaace9d4)

To stop the server, press the stop (square) button located at the top right corner of the terminal tab.

### React projects

A list of community-maintainted template projects including a React starter project can be found in the source control tab,.&#x20;
