摘要: 简单示例 const nunjucks = require('nunjucks'); // 配置 Nunjucks 环境 nunjucks.configure('views', { autoescape: true, //自动转义功能 默认为true 可以不写 }); // 渲染模板 nunjuck 阅读全文
posted @ 2024-04-04 21:00 C羽言 阅读(180) 评论(0) 推荐(0)
摘要: 'use strict'; const http = require('http'), fs = require('fs'), url = require('url'), path = require('path'); // 从命令行参数获取root目录,默认是当前目录 var root = pat 阅读全文
posted @ 2024-04-04 11:45 C羽言 阅读(35) 评论(0) 推荐(0)
摘要: 新建一个文件 server.js,代码如下 // 导入http模块 const http = require('http'); // 定义主机和端口号 const hostname = '127.0.0.1'; const port = 3000; // 创建HTTP服务器 const server 阅读全文
posted @ 2024-04-04 08:32 C羽言 阅读(608) 评论(0) 推荐(0)