Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyang424 committed May 7, 2024
2 parents e1c556d + 66df293 commit 0f48c95
Show file tree
Hide file tree
Showing 56 changed files with 1,757 additions and 164 deletions.
10 changes: 5 additions & 5 deletions src/.vuepress/navbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default navbar([
icon: "web",
link: "/web/",
},
// {
// text:"后端笔记",
// icon:"server",
// link:"/back/"
// },
{
text: "后端笔记",
icon: "server",
link: "/back/",
},
{
text: "运维笔记",
icon: "devops",
Expand Down
70 changes: 53 additions & 17 deletions src/.vuepress/public/iconfont/iconfont.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,58 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-collection:before {
content: "\e6d1";
}

.icon-express:before {
content: "\e60d";
}

.icon-cors:before {
content: "\e6d9";
}

.icon-sql:before {
content: "\e65b";
}

.icon-difficult:before {
content: "\e60e";
}

.icon-jsonwebtoken:before {
content: "\e795";
}

.icon-vue:before {
content: "\e703";
}

.icon-css:before {
content: "\e6e4";
}

.icon-html:before {
content: "\e6ba";
}

.icon-tauri:before {
content: "\e65e";
}

.icon-electron:before {
content: "\e8be";
}

.icon-taro:before {
content: "\e686";
}

.icon-harmonyOS:before {
content: "\e622";
}

.icon-domain:before {
content: "\e927";
}
Expand Down Expand Up @@ -67,14 +119,6 @@
content: "\eb95";
}

.icon-tauri:before {
content: "\e6a8";
}

.icon-electron:before {
content: "\e9dd";
}

.icon-more:before {
content: "\e6d0";
}
Expand Down Expand Up @@ -155,11 +199,7 @@
content: "\e68f";
}

.icon-vue:before {
content: "\f25f";
}

.icon-html:before {
.icon-h5:before {
content: "\e602";
}

Expand All @@ -183,10 +223,6 @@
content: "\e77d";
}

.icon-css:before {
content: "\ecae";
}

.icon-javascript:before {
content: "\e704";
}
Expand Down
Binary file modified src/.vuepress/public/iconfont/iconfont.ttf
Binary file not shown.
92 changes: 82 additions & 10 deletions src/.vuepress/sidebar/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { sidebar } from "vuepress-theme-hope";

export default sidebar({
"/web/": [
"",
Expand Down Expand Up @@ -57,21 +56,94 @@ export default sidebar({
icon: "mobile-dev",
prefix: "mobile-dev/",
collapsible: true,
children: "structure",
children: [
{
text: "移动开发概念",
link: "concept",
},
{
text: "移动开发技术",
link: "technology",
},
{
text: "H5",
icon: "h5",
collapsible: true,
prefix: "h5/",
children: "structure",
},
{
text: "小程序",
icon: "miniprogram",
collapsible: true,
prefix: "miniprogram/",
children: "structure",
},
{
text: "uni-app",
icon: "uni-app",
collapsible: true,
prefix: "uni-app/",
children: "structure",
},
{
text: "Taro",
icon: "taro",
collapsible: true,
prefix: "taro/",
children: "structure",
},
{
text: "React Native",
icon: "react",
collapsible: true,
prefix: "react-native/",
children: "structure",
},
{
text: "Flutter",
icon: "flutter",
collapsible: true,
prefix: "flutter/",
children: "structure",
},
{
text: "ArkTs",
icon: "harmonyOS",
collapsible: true,
prefix: "ark-ts/",
children: "structure",
},
],
},
{
text: "桌面应用",
icon: "desktop-dev",
prefix: "desktop-dev/",
collapsible: true,
children: "structure",
},
{
text: "小程序",
icon: "miniprogram",
prefix: "miniprogram/",
collapsible: true,
children: "structure",
children: [
{
text: "Electron",
icon: "electron",
collapsible: true,
prefix: "electron/",
children: "structure",
},
{
text: "Tauri",
icon: "tauri",
collapsible: true,
prefix: "tauri/",
children: "structure",
},
{
text: "Flutter",
icon: "flutter",
collapsible: true,
prefix: "flutter/",
children: "structure",
},
],
},
{
text: "插件",
Expand Down
33 changes: 19 additions & 14 deletions src/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default hopeTheme({
Gmail: "mailto:[email protected]",
Email:
"https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=%E6%9D%A8%E6%96%B0&icon=https%3A%2F%2Fp.qlogo.cn%2Fqqmail_head%2FBkBjDTOZTuwDOcyvCy2I1B6zbGSkls5zqHIyibStOeqCDQia3zH2Nlgjdd3pibS09TD%2F160&mail=xinyang424%40qq.com&code=FwUG9hkLKs-dHLjnuWFlkk14SMS1VLiQ_XBJqksBPYpKOi6fWFNZbmUlTJGRZOMz10Lq6BqONi27BbmSEKOOKA",
// 掘金: ["https://juejin.cn/user/4306129039670574/collections", "https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/static/favicons/apple-touch-icon.png"],
},
},
// themeColor: {
Expand Down Expand Up @@ -55,6 +56,7 @@ export default hopeTheme({
createdTime: false,
updatedTime: false,
},
// 评论设置
comment: {
provider: "Giscus",
repo: "xinyang424/xinyang424.github.io",
Expand All @@ -67,19 +69,21 @@ export default hopeTheme({
// provider: "Waline",
// serverURL: "https://blog.waline.coder-new.cn/",
},
// 博客内容搜索功能
searchPro: true,

mdEnhance: {
align: true,
attrs: true,
codetabs: true,
component: true,
demo: true,
figure: true,
imgLazyload: true,
imgSize: true,
include: true,
mark: true,
align: true, // 自定义对齐
// attrs: true, // 属性支持
codetabs: true, // 代码块分组
component: true, // 组件
demo: true, // 代码演示
figure: true, // 渲染的图片下面添加描述,或者点击图片带跳转
imgLazyload: true, // 图片懒加载
imgSize: true, // 设置图片大小 如![Alt](图片路径 "图片标题" =宽x高) https://theme-hope.vuejs.press/zh/guide/markdown/grammar/image.html#%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95
// include: true,// 导入文件
alert: true, // GFM 警告 https://theme-hope.vuejs.press/zh/guide/markdown/stylize/alert.html
mark: true, // 黄色标记 https://theme-hope.vuejs.press/zh/guide/markdown/stylize/mark.html
stylize: [
{
matcher: "Recommended",
Expand All @@ -93,10 +97,11 @@ export default hopeTheme({
},
},
],
sub: true,
sup: true,
tabs: true,
vPre: true,

// sub: true,// 下角标 https://theme-hope.vuejs.press/zh/guide/markdown/grammar/sup-sub.html
// sup: true,// 上角标 https://theme-hope.vuejs.press/zh/guide/markdown/grammar/sup-sub.html
tabs: true, // 选项卡 https://theme-hope.vuejs.press/zh/guide/markdown/content/tabs.html
// vPre: true, // https://theme-hope.vuejs.press/zh/guide/markdown/others.html#gfm
// revealJs: true,
// 在启用之前安装 chart.js
// chart: true,
Expand Down
9 changes: 7 additions & 2 deletions src/back/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
title: 后端笔记
icon: server
date: 2022-03-01
article: false
index: false
---



## 目录

- [SQL语句](sql.md)
- [Express](express.md)
- [cors](cors.md)
- [JWT](jwt.md)



46 changes: 46 additions & 0 deletions src/back/cors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: CORS
date: 2023-05-20
icon: cors
order: 3
---




## 基于 Nodejs + Express 实践

自行封装 cors:
```js
const express = require('express');
const router = express.Router();

router.all('*', function (req, res, next) {
/* 设置响应头,允许所有网站都可以请求,当然也可以进行白名单配置,运行哪些可以通过访问,其它不可通过访问 */
res.header('Access-Control-Allow-Origin', '*');
/* 设置我们的请求方式可以有以下这些 */
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE,OPTIONS');
/* 设置响应头可以有以下这些 */
res.header('Access-Control-Allow-Headers', 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With,token');
/* 放行 */
req.method === 'OPTIONS' ? res.status(204).end() : next();
});

module.exports = router;
```

使用的时候一定要在所有请求之前调用:
```js
const express = require('express');
const cors = require('./utils/cors');
const loginRouter = require('./routers/login');

//创建express服务 http
const app = express();

app.use(cors);//解决跨域问题

// 使用路由

app.use('/login', loginRouter);
```
12 changes: 0 additions & 12 deletions src/back/database/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions src/back/database/mangodb.md

This file was deleted.

Loading

0 comments on commit 0f48c95

Please sign in to comment.