first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>关于我</h1>
</body>
</html>

View File

@@ -0,0 +1 @@
var zhangsan = () => 5+21

View File

@@ -0,0 +1,14 @@
const http = require('http');
const { render } = require('./utils');
const url = require('url');
const util = require('util');
var index = function(req, res){
//render('test',res)
res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
res.end("你查询的参数是:"+(url.parse(req.url,true)).query.id)
}
// 熟悉 url 模块还有其他什么方法
http.createServer(index).listen(8080)

View File

@@ -0,0 +1,4 @@
var { demo,demo2 } = require('./utils')
demo()
demo2("nihazo")

View File

@@ -0,0 +1,11 @@
class utils {
private name: "";
constructor(name){
this.name = name;
}
public getNames(params?:string) : string {
return params+this.name;
}
}
(new utils("zhangsan")).getNames("你好")

View File

@@ -0,0 +1,28 @@
const mysql = require('mysql');
// 第一步 配置数据库连接
var pool = mysql.createPool({
host : 'localhost',
user : 'root',
password : 'lb714500',
database : 'shop'
});
// 连接数据库
// connection.connect();
// 第二部 配置查询数据库
var sql = "INSERT INTO shop_commodity(commodity_name) VALUES('大米科技')"
var params = ['4']
pool.query(sql,params, function (error, results, fields) {
if (error) throw error;
console.log(results);
});
// 目标实现一个小说爬虫
// 1: gulp 进行文件监听使用babel转换es6代码为es5js代码压缩
// 2: mysql数据库存储爬到的数据
// 3: 使用nodejs的web框架 express(koa2) 并改造
// 4: 使用nodejs nodemailer 向我们自己发送邮件,提示小说有没有更新,到底更新几章

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h2>我是本地的html文件</h2>
</body>
</html>

View File

@@ -0,0 +1,33 @@
const fs = require('fs');
// exports.demo = function () {
// console.log("我是demo方法")
// }
// module.exports = function () {
// console.log("我是demo方法")
// }
// module.exports.demo = function () {
// console.log("我是demo方法")
// }
function render(filename,res) {
res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
res.end((fs.readFileSync(`${filename}.html`)).toString())
}
function demo2() {
console.log("我是demo2方法")
}
// module.exports = {
// demo2(ddd) {
// console.log(ddd)
// },
// demo() {
// console.log("我是demo方法")
// }
// }
module.exports = { render , demo2}