generated from trywilco/Anythink-Market-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfile and package.json for simple Express server
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); |