自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 错误: 找不到或无法加载主类 xxx.class 解决办法

问题:Windows系统,javac编译已经通过,运行java xxx.class时报错:错误: 找不到或无法加载主类 xxx.class网上查搭配资料大多是说环境变量和package包的问题,可参考这个百度的回答:https://zhidao.baidu.com/question/523320925.html但是我确认配置无误,仍然报错。解决办法:运行的时候不要带上.class弄了很久,有点小坑。...

2021-01-15 11:24:10 711

转载 Web全栈开发学习笔记—Part5 测试 React 应用—d.端到端测试

目录CypressWriting to a formSome things to noteTesting new note formControlling the state of the databaseFailed login testBypassing the UIChanging the importance of a note接下来研究一种使用端到端End to End(E2E)测试,将系统作为一个整体的测试方法。可以使用浏览器和测试库对 web 应用进行.

2021-01-10 08:37:20 281

转载 Web全栈开发学习笔记—Part5 测试 React 应用—c.测试React 应用

目录Running testsTest file locationSearching for content in a componentDebugging testsClicking buttons in testsTests for the Togglable componentTesting the formsTest coverageFrontend integration testsSnapshot testing除了 Jest 之外还需要另一个测试库帮

2021-01-09 08:59:41 347

转载 Web全栈开发学习笔记—Part5 测试 React 应用—a.props.children 与 proptypes

目录Displaying the login form only when appropriateThe components children, aka. props.childrenState of the formsReferences to components with refOne point about componentsPropTypesESlintDisplaying the login form only when appropriate【在合适的时

2021-01-09 03:49:17 414 1

转载 Web全栈开发学习笔记—Part5 测试 React 应用—a.完成前台的登录功能

目录Creating new notesSaving the token to browsers local storage之前主要关注于后端,但前端目前还不支持后端用户管理。目前前端能够展示已经存在的 Note,并且允许用户切换 Note 的重要程度。由于我们在第四章节的修改,新的 Note 不能再添加了:因为在新建 Note 前,后端现在需要 token 来验证用户。现在将实现前台的用户管理功能的一部分。首先从用户登录开始,假设还不会从前端来添加用户。登录表单已经添加到了页面顶端

2021-01-08 11:11:36 189

转载 Web全栈开发学习笔记—Part4 测试 Express 服务端程序, 以及用户管理—d.密钥认证

目录Limiting creating new notes to logged in usersError handling现在将让后端支持基于令牌的认证下面的时序图描述了基于令牌认证的原理: 用户首先在 React 中通过登录表单登录 这会使得 React 代码将用户名和密码通过/api/login作为一个 HTTP POST 请求发送给服务器。 如果用户名和密码是正确的,服务器会生成一个token,用来标识登录的用户。这个 Token 是数字化签名的,也就是它不..

2021-01-08 02:26:06 628

转载 Web全栈开发学习笔记—Part4 测试 Express 服务端程序, 以及用户管理—c.用户管理

目录References across collectionsMongoose schema for usersCreating usersCreating a new notePopulate为增加用户认证和鉴权的功能。用户 应当存储在数据库中,并且每一个 便笺 应当关联到创建它的 用户。只有 便笺 的创建者才有删除和编辑它的权利。从向数据库添加用户信息开始。User和Note是典型的一对多关系关系型数据库来实现会显得比较直白。每个资源都会有独立的数据库表,而创...

2021-01-08 00:44:17 251

转载 Web全栈开发学习笔记—Part4 测试 Express 服务端程序, 以及用户管理—b.测试后端应用

目录Test environmentsupertestRunning tests one by oneasync/awaitasync/await in the backendMore tests and refactoring the backendError handling and async/awaitEliminating the try-catchOptimizing the beforeEach functionRefactoring tests现在

2021-01-07 11:02:35 468

转载 Web全栈开发学习笔记—Part4 测试 Express 服务端程序, 以及用户管理—a.从后端结构到测试入门

Project structure【项目结构】进入“测试”之前,修改 Node.js 项目的结构。 优化之后,得到如下结构:├── index.js├── app.js├── build│ └── ...├── controllers│ └── notes.js├── models│ └── note.js├── package-lock.json├── package.json├── utils│ ├── config.js│ ├── logger

2021-01-06 22:42:39 127

转载 Web全栈开发学习笔记—Part3 用NodeJS和Express写服务端程序—d.ESLint与代码检查

我们通常希望对存储在应用数据库中的数据应用一些约束,比如不应该接受缺少或空的content属性的便笺。在路由处理程序中检查便笺的有效性:app.post('/api/notes', (request, response) => { const body = request.body if (body.content === undefined) { return response.status(400).json({ error: 'content missing' })..

2021-01-05 22:12:18 314

转载 Web全栈开发学习笔记—Part3 用NodeJS和Express写服务端程序—c.将数据存入MongoDB

Debugging Node applications【调试Node应用】调试 Node 应用比调试在浏览器中运行的 JavaScript 稍微困难一些。 将数据打印到控制台是一种可靠的方法,即使是最顶尖的开源开发者也会usethismethod。Visual Studio CodeVisual Studio Code代码调试器在某些情况下可能很有用。 你可以像这样在调试模式下启动应用:注意,应用不应该在另一个控制台中运行,否则该端口将会冲突。注意更新版本的Vis...

2021-01-05 05:59:37 620

转载 Web全栈开发学习笔记—Part3 用NodeJS和Express写服务端程序—b.把应用部署到网上

接下来,将之前制作的前端连接到我们自己的后端。前面的部分中,前端可以从作为后端的 json 服务器向地址http://localhost:3001/notes索取便笺列表。现在后端有一个稍微不同的 url 结构,便笺可以从http://localhost:3001/api/notes中获取到。修改src/services/notes.js中的baseUrl属性 :import axios from 'axios'const baseUrl = 'http://localhos...

2021-01-04 04:59:19 414

转载 Web全栈开发学习笔记—Part3 用NodeJS和Express写服务端程序—a.Node.js 与 Express

目录Simple web serverExpressWeb and expressnodemonRESTFetching a single resourceDeleting resourcesPostmanReceiving dataAbout HTTP request typesMiddleware现在重点转向后端,也就是转向服务器端的功能实现。在NodeJS基础上构建的后端,是基于 Google 的Chrome V8引擎的 JavaScript 运..

2021-01-03 07:50:28 589

转载 Web全栈开发学习笔记—Part2 与服务端通信—e.给React应用加点样式

目录Improved error messageInline styles当前应用的外观是相当朴素的。现在向 React 应用添加样式。以传统的方式将 CSS 放在一个单独的文件中来添加到我们的应用; 先不使用CSS preprocessor。在src目录下添加一个新的index.css文件,然后通过导入index.js文件将其添加到应用中:import './index.css'让我们在index.CSS文件中添加如下 CSS 规则:h1 { color...

2021-01-02 01:30:25 202 1

转载 Web全栈开发学习笔记—Part2 与服务端通信—d.在服务端将数据Alert出来

目录RESTSending Data to the ServerChanging the importance of notesExtracting communication with the backend into a separate moduleCleaner syntax for defining object literalsPromises and errorsGet a full fake REST API with zero coding in less t

2021-01-01 05:27:46 354

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除