Commit a6871e1f authored by xiezhi's avatar xiezhi

feat: 创建 Node.js 22 模板项目

- 基于 node20-template 创建 node22-template
- 更新项目名称为 node22-hello-world
- 更新 Node.js 版本要求为 >=22.0.0
- 更新 Docker 基础镜像为 node22
- 更新所有文档和配置文件中的版本信息
- 配置新的 Git 远程仓库地址
parent 76f75766
{
"version": "1.0.0",
"name": "Node.js 20 Hello World",
"tags": ["nodejs", "hello-world", "http-server", "node20"],
"description": "基于Node.js 20的Hello World HTTP服务器示例",
"name": "Node.js 22 Hello World",
"tags": ["nodejs", "hello-world", "http-server", "node22"],
"description": "基于Node.js 22的Hello World HTTP服务器示例",
"init_commands": ["make install"],
"start_commands": ["make run"],
"stop_commands": ["make stop"],
......@@ -16,7 +16,7 @@
"deploy": [
{
"image_name": "node20-hello-world",
"image_name": "node22-hello-world",
"app_access_entry": true,
"ports": [
{
......
# 使用Node.js 20作为基础镜像
FROM hb.eazytec-cloud.com/eazytec/eazydevelop-node:ubuntu22.04-node20-latest
# 使用Node.js 22作为基础镜像
FROM hb.eazytec-cloud.com/eazytec/eazydevelop-node:ubuntu22.04-node22-latest
# 设置工作目录
WORKDIR /app
......
# 变量定义
APP_NAME = node20-hello-world
NODE_VERSION = 20
APP_NAME = node22-hello-world
NODE_VERSION = 22
MAIN_FILE = hello_world.js
APP_PORT = $(or $(APP_PORT_1),8080)
LOG_FILE = $(abspath $(dir $(lastword $(MAKEFILE_LIST))))/.logs/app.log
......@@ -107,7 +107,7 @@ clean:
# 显示帮助信息
.PHONY: help
help:
@echo "Node.js 20 HTTP 服务器项目"
@echo "Node.js 22 HTTP 服务器项目"
@echo ""
@echo "可用命令:"
@echo " make install - 安装依赖并准备项目"
......
# Node.js 20 HTTP 服务器项目
# Node.js 22 HTTP 服务器项目
这是一个使用Node.js 20编写的简单HTTP服务器示例,展示了基本的Node.js网络编程和HTTP服务实现。
这是一个使用Node.js 22编写的简单HTTP服务器示例,展示了基本的Node.js网络编程和HTTP服务实现。
## 项目结构
```
node20-template/
node22-template/
├── hello_world.js # 主程序文件
├── package.json # Node.js项目配置
├── Dockerfile # Docker容器化配置
......@@ -16,7 +16,7 @@ node20-template/
## 功能特性
- ✅ 基于Node.js 20的HTTP服务器
- ✅ 基于Node.js 22的HTTP服务器
- ✅ 使用内置的http模块
- ✅ 支持环境变量配置端口
- ✅ 返回"Hello World!"响应
......@@ -26,7 +26,7 @@ node20-template/
## 环境要求
- Node.js 20 或更高版本
- Node.js 22 或更高版本
- npm(Node.js包管理器)
- Make工具(可选,用于自动化构建)
- Docker(可选,用于容器化运行)
......@@ -78,10 +78,10 @@ make help
```bash
# 构建Docker镜像
docker build -t node20-hello-world .
docker build -t node22-hello-world .
# 运行容器
docker run -p 8080:8080 node20-hello-world
docker run -p 8080:8080 node22-hello-world
# 运行容器并指定端口
docker run -p 9090:8080 -e APP_PORT_1=8080 node20-hello-world
......@@ -137,7 +137,7 @@ Node.js项目配置文件:
- **项目信息**: 定义项目名称、版本、描述等
- **脚本命令**: 定义start、dev等npm脚本
- **引擎要求**: 指定Node.js版本要求(>=18.0.0)
- **引擎要求**: 指定Node.js版本要求(>=22.0.0)
### Makefile
......@@ -155,7 +155,7 @@ Node.js项目配置文件:
### Dockerfile
- 基于EazyTec Node.js 20 Ubuntu镜像
- 基于EazyTec Node.js 22 Ubuntu镜像
- 自动安装依赖和运行HTTP服务器
- 支持端口配置(APP_PORT_1环境变量)
- 暴露8080端口
......
{
"name": "node20-hello-world",
"name": "node22-hello-world",
"version": "1.0.0",
"description": "Node.js 20 HTTP 服务器示例",
"description": "Node.js 22 HTTP 服务器示例",
"main": "hello_world.js",
"scripts": {
"start": "node hello_world.js",
......@@ -17,6 +17,6 @@
"author": "",
"license": "MIT",
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment