Skip to content

Instantly share code, notes, and snippets.

View xiezipei's full-sized avatar
🎯
Focusing

xiezipei xiezipei

🎯
Focusing
View GitHub Profile
@xiezipei
xiezipei / 📊 Weekly development breakdown
Last active July 20, 2024 00:37
📊 Weekly development breakdown
Markdown 6 hrs ██████████░░░░░░░░░░░ 48.0%
JavaScript 1 hr 39 mins ██▊░░░░░░░░░░░░░░░░░░ 13.2%
JSON 1 hr 10 mins █▉░░░░░░░░░░░░░░░░░░░ 9.3%
Bash 58 mins █▋░░░░░░░░░░░░░░░░░░░ 7.8%
Groovy 50 mins █▍░░░░░░░░░░░░░░░░░░░ 6.7%
@xiezipei
xiezipei / helloByExpress.js
Created July 8, 2019 07:21
Express 的 Hello World 的示例
const express = require('express'); // 导入 Express 模块
const app = express(); // 创建 express() 实例
// 路由定义
// 监听根路径`/`
app.get('/', (req, res) => {
res.send('Hello World!');
});
// 在3000端口启动服务器并打印日志
@xiezipei
xiezipei / helloByNode.js
Last active July 8, 2019 07:22
用 Node.js 的 HTTP 包来创建一个简单的 web 服务器
// 调用 HTTP 模块
const http = require("http");
// 创建 HTTP 服务器并监听 8000 端口的所有请求
http.createServer((request, response) => {
// 用 HTTP 状态码和内容类型来设定 HTTP 响应头
response.writeHead(200, {'Content-Type': 'text/plain'});
// 发送响应体 "Hello World"