分类 node 中的文章

Blind Sql Injection

Security Risk: It is possible to view, modify or delete database entries and tables Cause: Sanitation of hazardous characters was not performed correctly on user input Fix: Review possible solutions for hazardous character injection Reasoning: The test result seems to indicate a vulnerability because it shows that values can be appended to parameter values, indicating that they were embedded in an SQL query. In this test, three (or sometimes four) requests are sent. The last is logically equal to the original, and the next-to-last is different. Any others are for control purposes. A comparison of the last two responses with the first (the last is similar to it, and the next-to-last is different) indicates that the application is vulnerable. How to fix https://sequelize.org/v5/manual/raw-queries.html make sure to ‘replace’/‘bind’……

阅读全文

React for Beginners

Prerequesite node javascript html css es6 code editor create-react-app npm install -g create-react-app create-react-app app-name React component state class component里面管理状态使用state class Counter extends Component { state = { counter: 10, title: "this is demo", products: [ { id: 1, name: "ok", }, { id: 2, name: "bad", }, ], }; // ..... other } render jsx expression attributes list/array conditional rendering handle events binding event handlers updating state event arguments passing data to component passing children debug react app props vs state raising and handle events multiple component in sync lifting state up functional component destructure arguments lifecycle hooks……

阅读全文

Sequelize Bulk Create to return with primary key in Postgre

Sequelize data model 在使用 bulkCreate的时候,如果想在返回的数据中包括生成的id, 需要加上option, { returning: true } return CertificationEndUsers.bulkCreate(usersToInsert, { returning: true }); 另外 postgresql中table name包含双引号和不包含的,竟然是不一样的两个table "users" users 比如这是两个table……

阅读全文

Python Nest

背景 最近有做一个nestjs的项目,用的nestjs实现的微服务,如果所有的功能都用node/nestjs写,那倒也没有什么问题了。可是有一个功能是需要用到机器学习,代码是用python写的,需要用python实现一个微服务,供nest app来调用,同时,python代码也需要调……

阅读全文