Skip to content

Commit

Permalink
Add Dockerfile and package.json for simple Express server
Browse files Browse the repository at this point in the history
  • Loading branch information
shem8 committed Oct 27, 2024
1 parent d64969a commit 2adc7a1
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
9 changes: 9 additions & 0 deletions simple-express-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:14

WORKDIR /app

COPY package*.json /app
RUN yarn install
EXPOSE 8001

CMD [ "yarn", "start" ]
56 changes: 56 additions & 0 deletions simple-express-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Simple Express Server

This is a simple Express server that listens on port 8001. It does not have any endpoints defined.

## Prerequisites

- Node.js
- Yarn

## Getting Started

1. Clone the repository:

```bash
git clone https://github.com/your-username/simple-express-server.git
```

2. Install the dependencies:

```bash
cd simple-express-server
yarn install
```

3. Start the server:

```bash
yarn start
```

The server will be running at http://localhost:8001.

## Docker

To run the server using Docker, follow these steps:

1. Build the Docker image:

```bash
docker build -t simple-express-server .
```

2. Run the Docker container:

```bash
docker run -p 8001:8001 simple-express-server
```

The server will be accessible at http://localhost:8001.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
```
Please note that you need to replace `your-username` in the clone command with your actual GitHub username.
18 changes: 18 additions & 0 deletions simple-express-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "simple-express-server",
"version": "1.0.0",
"description": "A simple Express server",
"main": "src/app.js",
"scripts": {
"start": "nodemon src/app.js"
},
"dependencies": {
"express": "^4.17.1"
},
"devDependencies": {
"nodemon": "^2.0.12"
},
"engines": {
"node": ">=12.0.0"
}
}
8 changes: 8 additions & 0 deletions simple-express-server/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');
const app = express();

const PORT = 8001;

app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});

0 comments on commit 2adc7a1

Please sign in to comment.