{"id":322296,"date":"2021-04-29T09:00:33","date_gmt":"2021-04-29T09:00:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322296"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322296","title":{"rendered":"\u041e\u0431\u0437\u043e\u0440 Prisma ORM"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vx\/k5\/9q\/vxk59qa3zzqpy_maac9wkyp_yc8.png\"><\/p>\n<p>  \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f-\u043e\u0431\u0437\u043e\u0440 \u043e <a href=\"https:\/\/www.prisma.io\/\">Prisma ORM<\/a>.<\/p>\n<p>  ORM (\u0430\u043d\u0433\u043b. Object-Relational Mapping \u2014 \u00ab\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u00bb) \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u00ab\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0442.\u043f.) \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. Prisma \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043c\u0435\u0441\u0442\u043e SQL.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Prisma?<\/h2>\n<p>  \u041a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, Prisma \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u00ab\u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e ORM \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f Node.js \u0438 TypeScript\u00bb, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0443\u044e \u00ab\u043d\u043e\u0432\u0443\u044e \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u00bb.<\/p>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>JavaScript<\/li>\n<li>TypeScript<\/li>\n<li>Go (\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435)<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>MySQL<\/li>\n<li>PostgreSQL<\/li>\n<li>SQLite<\/li>\n<li>MSSQL (\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435)<\/li>\n<li>MongoDB Connector (\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435)<\/li>\n<\/ul>\n<p>  \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.prisma.io\/client\">Prisma Client<\/a>: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0438 \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0411\u0414<\/li>\n<li><a href=\"https:\/\/www.prisma.io\/migrate\">Prisma Migrate<\/a>: \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/li>\n<li><a href=\"https:\/\/www.prisma.io\/studio\">Prisma Studio<\/a>: \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=Prisma.prisma\">Prisma VSCode Extension<\/a>: \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f VSCode, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0435 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u0430\u0432\u0442\u043e\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435, \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u0440.<\/li>\n<\/ul>\n<p>  Prisma Client \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u043b\u044e\u0431\u043e\u043c Node.js \u0438\u043b\u0438 TypeScript \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c REST API, GraphQL API, gRPC API \u0438 \u0442.\u0434.<\/p>\n<h3>\u041a\u0430\u043a Prisma \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/h3>\n<p>  \u0412\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f <a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-schema\">\u0441\u0445\u0435\u043c\u044b<\/a>. \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430. \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0411\u0414 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440:<\/p>\n<p>  <code>datasource db {<\/p>\n<p>  provider = \u00abpostgresql\u00bb<\/p>\n<p>  url = env(\u00abDATABASE_URL\u00bb)<\/p>\n<p>  }<\/p>\n<p>  generator client {<\/p>\n<p>  provider = \u00abprisma-client-js\u00bb<\/p>\n<p>  }<\/p>\n<p>  model Post {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  title String<\/p>\n<p>  content String?<\/p>\n<p>  published Boolean @default(false)<\/p>\n<p>  author User? @relation(fields: [authorId], references: [id])<\/p>\n<p>  authorId Int?<\/p>\n<p>  }<\/p>\n<p>  model User {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  email String @unique<\/p>\n<p>  name String?<\/p>\n<p>  posts Post[]<\/p>\n<p>  }<\/code><\/p>\n<p>  \u041a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0411\u0414 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e Prisma Client \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-schema\/data-sources\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 (data source)<\/a>: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0411\u0414 (\u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u044b \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f)<\/li>\n<li><a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-schema\/generators\">\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 (generator)<\/a>: \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Prisma Client<\/li>\n<li>\u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 (data model): \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/li>\n<\/ul>\n<p>  \u041c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f <a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-schema\/data-model#defining-models\">\u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/a>. \u0413\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414<\/li>\n<li>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 Prisma Client<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Prisma Client \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0430\u043a\u0435\u0442 \u0438\u0437 npm:<\/p>\n<p>  <code>yarn add @prisma\/client<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm i @prisma\/client<\/code><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>prisma generate<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<p>  <code>import { PrismaClient } from '@prisma\/client'<\/p>\n<p>  const prisma = new PrismaClient()<\/code><\/p>\n<h2>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  Prisma Migrate \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0445\u0435\u043c\u0443 \u0432 SQL \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0411\u0414. \u041c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>prisma migrate<\/code>, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 <a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-cli\">Prisma CLI<\/a>. \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 SQL \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 (SQLite):<\/p>\n<p>  <code>CREATE TABLE \u00abPost\u00bb (<\/p>\n<p>  \u00abid\u00bb INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,<\/p>\n<p>  \u00abtitle\u00bb TEXT NOT NULL,<\/p>\n<p>  \u00abcontent\u00bb TEXT,<\/p>\n<p>  \u00abpublished\u00bb BOOLEAN NOT NULL DEFAULT false,<\/p>\n<p>  \u00abauthorId\u00bb INTEGER,<\/p>\n<p>  FOREIGN KEY (\u00abauthorId\u00bb) REFERENCES \u00abUser\u00bb (\u00abid\u00bb) ON DELETE SET NULL ON UPDATE CASCADE<\/p>\n<p>  );<\/p>\n<p>  CREATE TABLE \u00abUser\u00bb (<\/p>\n<p>  \u00abid\u00bb INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,<\/p>\n<p>  \u00abemail\u00bb TEXT NOT NULL,<\/p>\n<p>  \u00abname\u00bb TEXT<\/p>\n<p>  );<\/p>\n<p>  CREATE UNIQUE INDEX \u00abUser.email_unique\u00bb ON \u00abUser\u00bb(\u00abemail\u00bb);<\/code><\/p>\n<h2>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c<\/h2>\n<p>  Prisma Client \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043c\u044b\u0441\u043b\u0438\u0442\u044c \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0411\u0414 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0435 JavaScript-\u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<p>  <code>\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<p>  const posts = await prisma.post.findMany()<\/p>\n<p>  \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0430\u0432\u0442\u043e\u0440\u043e\u0432<\/p>\n<p>  const postsWithAuthors = await prisma.post.findMany({<\/p>\n<p>  include: { author: true }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u0441\u0442\u043e\u043c<\/p>\n<p>  const userWithPosts = await prisma.user.create({<\/p>\n<p>  data: {<\/p>\n<p>  email: 'john@mail.com',<\/p>\n<p>  name: 'John Smith',<\/p>\n<p>  posts: {<\/p>\n<p>  create: [{ title: 'Hello World' }]<\/p>\n<p>  }<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c John<\/p>\n<p>  const users = await prisma.user.findMany({<\/p>\n<p>  where: {<\/p>\n<p>  name: { contains: 'John' }<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  const postsByUser = await prisma.user.findUnique({<\/p>\n<p>  where: { email: 'john@mail.com' }<\/p>\n<p>  }).posts()<\/p>\n<p>  \/\/ \u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f<\/p>\n<p>  const posts = await prisma.post.findMany({<\/p>\n<p>  take: 5,<\/p>\n<p>  cursor: { id: '3' }<\/p>\n<p>  })<\/code><\/p>\n<p>  \u0421 \u043f\u043e\u043b\u043d\u044b\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c API \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/www.prisma.io\/docs\/reference\/api-reference\/prisma-client-reference\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/h2>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite \u043d\u0430 TypeScript \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prisma Client.<\/p>\n<h3>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h3>\n<p>  \u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f 2 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0434\u0438\u043d \u043d\u0430 JavaScript, \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430 TypeScript; \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0430):<\/p>\n<p>  <code>git clone https:\/\/github.com\/prisma\/quickstart.git<\/code><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <code># \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e<\/p>\n<p>  cd quickstart\/typescript\/starter<\/p>\n<p>  # \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/p>\n<p>  yarn<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm i<\/p>\n<p>  # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430<\/p>\n<p>  code .<\/code><\/p>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 6 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<ul>\n<li><code>package.json<\/code>: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0442.\u0434.)<\/li>\n<li><code>prisma\/schema.prisma<\/code>: \u0441\u0445\u0435\u043c\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/li>\n<li><code>prisma\/.env<\/code>: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 URL \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u044b \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/li>\n<li><code>prisma\/dev.db<\/code>: \u0444\u0430\u0439\u043b \u0411\u0414 SQLite<\/li>\n<li><code>script.ts<\/code>: \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 TypeScript<\/li>\n<li><code>tsconfig.json<\/code>: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 TypeScript<\/li>\n<\/ul>\n<p>  \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ul>\n<li><code>prisma<\/code>: Prisma CLI, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>npx prisma<\/code><\/li>\n<li><code>@prisma\/client<\/code>: Prisma Client \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0411\u0414<\/li>\n<li><code>typescript<\/code>: \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 TypeScript<\/li>\n<li><code>ts-node<\/code>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 TypeScript<\/li>\n<\/ul>\n<p>  \u0424\u0430\u0439\u043b <code>prisma\/dev.db<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>User<\/th>\n<\/tr>\n<tr>\n<th>id<\/th>\n<th>email<\/th>\n<th>name<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>sarah@prisma.io<\/td>\n<td>Sarah<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>maria@prisma.io<\/td>\n<td>Maria<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>Post<\/th>\n<\/tr>\n<tr>\n<th>id<\/th>\n<th>title<\/th>\n<th>content<\/th>\n<th>published<\/th>\n<th>authorId<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>Hello World<\/td>\n<td>null<\/td>\n<td>false<\/td>\n<td>2<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043a\u043e\u043b\u043e\u043d\u043a\u0430 <code>authorId<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <code>User<\/code>, \u0442.\u0435. <code>2<\/code> \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 <code>authorId<\/code> \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>Post<\/code> \u2014 \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <code>2<\/code> \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0435 <code>id<\/code> \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>User<\/code>.<\/p>\n<h3>\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0411\u0414 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prisma Client, \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0430\u0448\u0443 \u0441\u0445\u0435\u043c\u0443:<\/p>\n<p>  <code>datasource db {<\/p>\n<p>  provider = \u00absqlite\u00bb<\/p>\n<p>  url = env(\u00abDATABASE_URL\u00bb)<\/p>\n<p>  }<\/p>\n<p>  generator client {<\/p>\n<p>  provider = \u00abprisma-client-js\u00bb<\/p>\n<p>  }<\/p>\n<p>  model Post {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  title String<\/p>\n<p>  content String?<\/p>\n<p>  published Boolean @default(false)<\/p>\n<p>  author User? @relation(fields: [authorId], references: [id])<\/p>\n<p>  authorId Int?<\/p>\n<p>  }<\/p>\n<p>  model User {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  email String @unique<\/p>\n<p>  name String?<\/p>\n<p>  posts Post[]<\/p>\n<p>  }<\/code><\/p>\n<p>  \u0424\u0430\u0439\u043b <code>script.ts<\/code> \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <code>import { PrismaClient } from '@prisma\/client'<\/p>\n<p>  const prisma = new PrismaClient()<\/p>\n<p>  async function main() {<\/p>\n<p>  \/\/ \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/p>\n<p>  }<\/p>\n<p>  main()<\/p>\n<p>  .catch(e =&gt; {<\/p>\n<p>  throw e<\/p>\n<p>  })<\/p>\n<p>  .finally(async () =&gt; {<\/p>\n<p>  await prisma.$disconnect()<\/p>\n<p>  })<\/code><\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439:<br \/>  <code>async function main() {<\/p>\n<p>  const allUsers = await prisma.user.findMany()<\/p>\n<p>  console.log(allUsers)<\/p>\n<p>  }<\/code><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <code>yarn dev<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm run dev<\/code><\/p>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435:<\/p>\n<p>  <code>[<\/p>\n<p>  { id: 1, email: 'sarah@prisma.io', name: 'Sarah' },<\/p>\n<p>  { id: 2, email: 'maria@prisma.io', name: 'Maria' },<\/p>\n<p>  ]<\/code><\/p>\n<p>  \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 Prisma Client, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043b\u0435\u0433\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 <code>include<\/code>. \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main()<\/code>:<\/p>\n<p>  <code>async function main() {<\/p>\n<p>  const allUsers = await prisma.user.findMany({<\/p>\n<p>  include: { posts: true }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c `console.dir` \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/p>\n<p>  console.dir(allUsers, { depth: null })<\/p>\n<p>  }<\/code><\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u0434:<\/p>\n<p>  <code>yarn dev<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm run dev<\/code><\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>posts<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u044e \u0441\u0432\u044f\u0437\u0438 \u043c\u0435\u0436\u0434\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438 <code>User<\/code> \u0438 <code>Post<\/code>:<\/p>\n<p>  <code>[<\/p>\n<p>  { id: 1, email: 'sarah@prisma.io', name: 'Sarah', posts: [] },<\/p>\n<p>  {<\/p>\n<p>  id: 2,<\/p>\n<p>  email: 'maria@prisma.io',<\/p>\n<p>  name: 'Maria',<\/p>\n<p>  posts: [<\/p>\n<p>  {<\/p>\n<p>  id: 1,<\/p>\n<p>  title: 'Hello World',<\/p>\n<p>  content: null,<\/p>\n<p>  published: false,<\/p>\n<p>  authorId: 2,<\/p>\n<p>  }<\/p>\n<p>  ]<\/p>\n<p>  }<\/p>\n<p>  ]<br \/>  <\/code><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>allUsers<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f <a href=\"https:\/\/www.prisma.io\/docs\/concepts\/components\/prisma-client\/advanced-type-safety\/operating-against-partial-structures-of-model-types\">\u0442\u0438\u043f\u0430\u043c, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u043c Prisma Client<\/a>. \u0412 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0430\u0432\u0435\u0441\u0442\u0438 \u043a\u0443\u0440\u0441\u043e\u0440 \u043d\u0430 <code>allUsers<\/code> \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 (VSCode \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 TypeScript):<\/p>\n<p>  <code>const allUsers: (User &amp; {<\/p>\n<p>  posts: Post[]<\/p>\n<p>  })[]<\/p>\n<p>  export type Post = {<\/p>\n<p>  id: number<\/p>\n<p>  title: string<\/p>\n<p>  content: string | null<\/p>\n<p>  published: boolean<\/p>\n<p>  authorId: number | null<\/p>\n<p>  }<\/code><\/p>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 <code>findMany<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0411\u0414. \u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 <code>create<\/code>:<\/p>\n<p>  <code>async function main() {<\/p>\n<p>  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u0441\u0442<\/p>\n<p>  const post = await prisma.post.create({<\/p>\n<p>  data: {<\/p>\n<p>  title: 'Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414',<\/p>\n<p>  author: {<\/p>\n<p>  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0441\u0442 \u043a \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 `User`<\/p>\n<p>  connect: { email: 'sarah@prisma.io' }<\/p>\n<p>  }<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  console.log(post)<\/p>\n<p>  const allUsers = await prisma.user.findMany({<\/p>\n<p>  include: { posts: true }<\/p>\n<p>  })<\/p>\n<p>  console.dir(allUsers, { depth: null })<\/p>\n<p>  }<br \/>  <\/code><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u0434:<\/p>\n<p>  <code>yarn dev<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm run dev<\/p>\n<p>  <\/code><\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <code>{<\/p>\n<p>  id: 2,<\/p>\n<p>  title: 'Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414',<\/p>\n<p>  content: null,<\/p>\n<p>  published: false,<\/p>\n<p>  authorId: 1<\/p>\n<p>  }<\/p>\n<p>  [<\/p>\n<p>  {<\/p>\n<p>  id: 1,<\/p>\n<p>  email: 'sarah@prisma.io',<\/p>\n<p>  name: 'Sarah',<\/p>\n<p>  posts: [<\/p>\n<p>  {<\/p>\n<p>  id: 2,<\/p>\n<p>  title: 'Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414',<\/p>\n<p>  content: null,<\/p>\n<p>  published: false,<\/p>\n<p>  authorId: 1<\/p>\n<p>  }<\/p>\n<p>  ]<\/p>\n<p>  },<\/p>\n<p>  {<\/p>\n<p>  id: 2,<\/p>\n<p>  email: 'maria@prisma.io',<\/p>\n<p>  name: 'Maria',<\/p>\n<p>  posts: [<\/p>\n<p>  {<\/p>\n<p>  id: 1,<\/p>\n<p>  title: 'Hello World',<\/p>\n<p>  content: null,<\/p>\n<p>  published: false,<\/p>\n<p>  authorId: 2<\/p>\n<p>  }<\/p>\n<p>  ]<\/p>\n<p>  }<\/p>\n<p>  ]<\/code><\/p>\n<p>  \u041d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <code>Post<\/code>:<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>Post<\/th>\n<\/tr>\n<tr>\n<th>id<\/th>\n<th>title<\/th>\n<th>content<\/th>\n<th>published<\/th>\n<th>authorId<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>Hello World<\/td>\n<td>null<\/td>\n<td>false<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414<\/td>\n<td>null<\/td>\n<td>false<\/td>\n<td>1<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u00ab\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c\u00bb \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 <code>update<\/code>:<\/p>\n<p>  <code>async function main() {<\/p>\n<p>  const post = await prisma.post.update({<\/p>\n<p>  where: { id: 2 },<\/p>\n<p>  data: { published: true }<\/p>\n<p>  })<\/p>\n<p>  console.log(post)<\/p>\n<p>  }<\/code><\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u0434:<\/p>\n<p>  <code>yarn dev<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm run dev<\/code><\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <code>{<\/p>\n<p>  id: 2,<\/p>\n<p>  title: 'Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414',<\/p>\n<p>  content: null,<\/p>\n<p>  published: true,<\/p>\n<p>  authorId: 1<\/p>\n<p>  }<br \/>  <\/code><\/p>\n<p>  \u041d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0431\u043d\u043e\u0432\u0438\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>Post<\/code>:<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>Post<\/th>\n<\/tr>\n<tr>\n<th>id<\/th>\n<th>title<\/th>\n<th>content<\/th>\n<th>published<\/th>\n<th>authorId<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>Hello World<\/td>\n<td>null<\/td>\n<td>false<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>Prisma \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0411\u0414<\/td>\n<td>null<\/td>\n<td>true<\/td>\n<td>1<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h3>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b<\/h3>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c (<code>Profile<\/code>) \u0432 \u043d\u0430\u0448\u0443 \u0441\u0445\u0435\u043c\u0443:<\/p>\n<p>  <code>model Post {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  title String<\/p>\n<p>  content String?<\/p>\n<p>  published Boolean @default(false)<\/p>\n<p>  author User? @relation(fields: [authorId], references: [id])<\/p>\n<p>  authorId Int?<\/p>\n<p>  }<\/p>\n<p>  model User {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  email String @unique<\/p>\n<p>  name String?<\/p>\n<p>  posts Post[]<\/p>\n<p>  profile Profile?<\/p>\n<p>  }<\/p>\n<p>  model Profile {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  bio String<\/p>\n<p>  user User @relation(fields: [userId], references: [id])<\/p>\n<p>  userId Int @unique<\/p>\n<p>  }<\/code><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043c\u043e\u0434\u0435\u043b\u044c <code>User<\/code>.<\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <code>npx prisma migrate dev --name add-profile<\/code><\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>Profile<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>prisma.profile.findMany()<\/code>.<\/p>\n<h2>Express REST API<\/h2>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u0441 \u043d\u0443\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c REST API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prisma Client, Express \u0438 TypeScript.<\/p>\n<p>  REST (\u043e\u0442 \u0430\u043d\u0433\u043b. Representational State Transfer \u2014 \u00ab\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb) \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0442\u0438.<\/p>\n<h3>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/h3>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<p>  <code># \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438<\/p>\n<p>  mkdir prisma-express<\/p>\n<p>  cd !$<\/p>\n<p>  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<p>  yarn init -yp<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm init -y<\/p>\n<p>  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/p>\n<p>  yarn add @prisma\/client express<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm i @prisma\/client express<\/p>\n<p>  # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<p>  yarn add -D prisma typescript ts-node @types\/express @types\/node<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm i -D prisma typescript ts-node @types\/express @types\/node<br \/>  <\/code><\/p>\n<p>  \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439:<\/p>\n<p>  <code>- prisma<\/p>\n<p>  - schema.prisma \u2014 \u0441\u0445\u0435\u043c\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u0438 Prisma<\/p>\n<p>  - seed.ts \u2014 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0411\u0414 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<p>  - index.ts \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<p>  - package.json<\/p>\n<p>  - tscongig.json \u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TypeScript<\/code><\/p>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 <code>package.json<\/code>:<\/p>\n<p>  <code>{<\/p>\n<p>  \u00abname\u00bb: \u00abprisma-express\u00bb,<\/p>\n<p>  \u00abversion\u00bb: \u00ab1.0.0\u00bb,<\/p>\n<p>  \u00ablicense\u00bb: \u00abMIT\u00bb,<\/p>\n<p>  \u00abscripts\u00bb: {<\/p>\n<p>  \u00abdev\u00bb: \u00abts-node src\/index.ts\u00bb<\/p>\n<p>  },<\/p>\n<p>  \u00abdependencies\u00bb: {<\/p>\n<p>  \u00ab@prisma\/client\u00bb: \u00ab2.21.2\u00bb,<\/p>\n<p>  \u00abexpress\u00bb: \u00ab4.17.1\u00bb<\/p>\n<p>  },<\/p>\n<p>  \u00abdevDependencies\u00bb: {<\/p>\n<p>  \u00abprisma\u00bb: \u00ab2.21.2\u00bb,<\/p>\n<p>  \u00ab@types\/express\u00bb: \u00ab4.17.11\u00bb,<\/p>\n<p>  \u00ab@types\/node\u00bb: \u00ab12.20.10\u00bb,<\/p>\n<p>  \u00abts-node\u00bb: \u00ab9.1.1\u00bb,<\/p>\n<p>  \u00abtypescript\u00bb: \u00ab4.2.4\u00bb<\/p>\n<p>  }<\/p>\n<p>  }<br \/>  <\/code><\/p>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 <code>tsconfig.json<\/code>:<\/p>\n<p>  <code> {<\/p>\n<p>  \u00abcompilerOptions\u00bb: {<\/p>\n<p>  \u00absourceMap\u00bb: true,<\/p>\n<p>  \u00aboutDir\u00bb: \u00abdist\u00bb,<\/p>\n<p>  \u00abstrict\u00bb: true,<\/p>\n<p>  \u00ablib\u00bb: [\u00abesnext\u00bb],<\/p>\n<p>  \u00abesModuleInterop\u00bb: true<\/p>\n<p>  }<\/p>\n<p>  }<br \/>  <\/code><\/p>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0438 \u043c\u043e\u0434\u0435\u043b\u0438<\/h3>\n<p>  \u041d\u0430\u0448\u0430 \u0441\u0445\u0435\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 2 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u2014 <code>User<\/code> \u0438 <code>Post<\/code>:<\/p>\n<p>  <code>\/\/ prisma\/schema.prisma<\/p>\n<p>  generator client {<\/p>\n<p>  provider = \u00abprisma-client-js\u00bb<\/p>\n<p>  }<\/p>\n<p>  datasource db {<\/p>\n<p>  provider = \u00absqlite\u00bb<\/p>\n<p>  url = \u00abfile:.\/dev.db\u00bb<\/p>\n<p>  }<\/p>\n<p>  model User {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  email String @unique<\/p>\n<p>  name String?<\/p>\n<p>  posts Post[]<\/p>\n<p>  }<\/p>\n<p>  model Post {<\/p>\n<p>  id Int @id @default(autoincrement())<\/p>\n<p>  createdAt DateTime @default(now())<\/p>\n<p>  updatedAt DateTime @updatedAt<\/p>\n<p>  title String<\/p>\n<p>  content String?<\/p>\n<p>  published Boolean @default(false)<\/p>\n<p>  viewCount Int @default(0)<\/p>\n<p>  author User? @relation(fields: [authorId], references: [id])<\/p>\n<p>  authorId Int?<\/p>\n<p>  }<br \/>  <\/code><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0443\u0435\u043c SQLite \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0411\u0414, \u043c\u043e\u0434\u0435\u043b\u044c <code>User<\/code> \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c, \u0430 \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 <code>Post<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  \u0424\u0430\u0439\u043b <code>prisma\/seed.ts<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0411\u0414 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0412\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <code>import { PrismaClient, Prisma } from '@prisma\/client'<\/p>\n<p>  const prisma = new PrismaClient()<\/p>\n<p>  const userData: Prisma.UserCreateInput[] = [<\/p>\n<p>  {<\/p>\n<p>  name: 'John',<\/p>\n<p>  email: 'john@mail.com',<\/p>\n<p>  posts: {<\/p>\n<p>  create: [<\/p>\n<p>  {<\/p>\n<p>  title: 'Title1',<\/p>\n<p>  content: 'Some text',<\/p>\n<p>  published: true,<\/p>\n<p>  },<\/p>\n<p>  ],<\/p>\n<p>  },<\/p>\n<p>  },<\/p>\n<p>  {<\/p>\n<p>  name: 'Jane',<\/p>\n<p>  email: 'jane@mail.com',<\/p>\n<p>  posts: {<\/p>\n<p>  create: [<\/p>\n<p>  {<\/p>\n<p>  title: 'Title2',<\/p>\n<p>  content: 'Another text',<\/p>\n<p>  published: true,<\/p>\n<p>  },<\/p>\n<p>  ],<\/p>\n<p>  },<\/p>\n<p>  },<\/p>\n<p>  {<\/p>\n<p>  name: 'Alice',<\/p>\n<p>  email: 'alice@mail.com',<\/p>\n<p>  posts: {<\/p>\n<p>  create: [<\/p>\n<p>  {<\/p>\n<p>  title: 'Title3',<\/p>\n<p>  content: 'And another',<\/p>\n<p>  published: true,<\/p>\n<p>  },<\/p>\n<p>  {<\/p>\n<p>  title: 'Title4',<\/p>\n<p>  content: 'And another once again',<\/p>\n<p>  },<\/p>\n<p>  ],<\/p>\n<p>  },<\/p>\n<p>  },<\/p>\n<p>  ]<\/p>\n<p>  async function main() {<\/p>\n<p>  console.log(`\u041d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0411\u0414 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438...`)<\/p>\n<p>  for (const u of userData) {<\/p>\n<p>  const user = await prisma.user.create({<\/p>\n<p>  data: u,<\/p>\n<p>  })<\/p>\n<p>  console.log(`\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 id ${user.id} \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d`)<\/p>\n<p>  }<\/p>\n<p>  console.log(`\u041d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0411\u0414 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043e.`)<\/p>\n<p>  }<\/p>\n<p>  main()<\/p>\n<p>  .catch((e) =&gt; {<\/p>\n<p>  console.error(e)<\/p>\n<p>  process.exit(1)<\/p>\n<p>  })<\/p>\n<p>  .finally(async () =&gt; {<\/p>\n<p>  await prisma.$disconnect()<\/p>\n<p>  })<\/code><\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 <code>userData<\/code> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 <code>create<\/code>.<\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 REST API, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0411\u0414 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0411\u0414 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <code>npx prisma migrate dev --name init<\/code><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/031\/19e\/ad9\/03119ead9e2ec073e07ab8713d018799.png\"><\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438\u0437 <code>prisma\/seed.ts<\/code>:<\/p>\n<p>  <code>npx prisma db seed --preview-feature<\/code><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/da6\/84c\/67e\/da684c67e11c93bcd205bae17e196d9b.png\"><\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448\u0430 \u0411\u0414 \u0433\u043e\u0442\u043e\u0432\u0430 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<h3>REST API<\/h3>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Express:<\/p>\n<p>  <code>\/\/ index.ts<\/p>\n<p>  \/\/ \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c Express<\/p>\n<p>  import express from 'express'<\/p>\n<p>  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<p>  const app = express()<\/p>\n<p>  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 (middleware) \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 JSON \u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 req.body<\/p>\n<p>  app.use(express.json())<\/p>\n<p>  \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 3000<\/p>\n<p>  app.listen(3000, () =&gt; console.log(` \u0421\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: http:\/\/localhost:3000`))<br \/>  <\/code><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c Prisma Client \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<p>  <code>import express from 'express'<\/p>\n<p>  \/\/ \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c Prisma Client \u0438 \u0442\u0438\u043f\u044b \u0434\u043b\u044f TypeScript<\/p>\n<p>  import { Prisma, PrismaClient } from '@prisma\/client'<\/p>\n<p>  const app = express()<\/p>\n<p>  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/p>\n<p>  const prisma = new PrismaClient()<\/code><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 (endpoints), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0443\u0436\u043d\u044b \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e:<\/p>\n<p>  <code>`GET`<\/p>\n<p>  - `\/users`: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<p>  - `\/post\/:id`: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430 \u043f\u043e \u0435\u0433\u043e `id`<\/p>\n<p>  - `\/user\/:id\/drafts`: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u043e\u0432 (\u043d\u0435\u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432, \u043f\u043e\u0441\u0442\u043e\u0432, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 `published` \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f `false`) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  - `\/feed?searchString={searchString}&amp;take={take}&amp;skip={skip}&amp;orderBy={orderBy}`: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<p>  - \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438):<\/p>\n<p>  - `searchString`: \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432 \u043f\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 (`title`) \u0438\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044e (`content`)<\/p>\n<p>  - `take`: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/p>\n<p>  - `skip`: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u044b<\/p>\n<p>  - `orderBy`: \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u2014 \u043f\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: `asc` \u0438\u043b\u0438 `desc`<\/p>\n<p>  `POST`<\/p>\n<p>  - `\/post`: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/p>\n<p>  - \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<p>  - `title: String` \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u043e\u0441\u0442\u0430 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e)<\/p>\n<p>  - `content: String` \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430 (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/p>\n<p>  - `authorEmail: String`: \u0430\u0434\u0440\u0435\u0441 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u043e\u0441\u0442\u0430 (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e)<\/p>\n<p>  - `\/signup`: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  - \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<p>  - `email: String`: email \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e)<\/p>\n<p>  - `name: String`: \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/p>\n<p>  - `postData: PostCreateInput[]`: \u043f\u043e\u0441\u0442\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e)<\/p>\n<p>  `PUT`<\/p>\n<p>  - `publish\/:id`: \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430 (\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 `published` \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 `true`)<\/p>\n<p>  - `\/post\/:id\/views`: \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<\/p>\n<p>  `DELETE`<\/p>\n<p>  - `\/post\/:id`: \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430<br \/>  <\/code><\/p>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 GET-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439:<\/p>\n<p>  <code>app.get('\/users', async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 `findMany()`<\/p>\n<p>  const users = await prisma.user.findMany()<\/p>\n<p>  \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON<\/p>\n<p>  res.json(users)<\/p>\n<p>  })<\/code><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430:<\/p>\n<p>  <code>app.get(`\/post\/:id`, async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c `id` \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { id } = req.params<\/p>\n<p>  \/\/ \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e (\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e) \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 `findUnique()`<\/p>\n<p>  \/\/ \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 `where` (\u0433\u0434\u0435)<\/p>\n<p>  \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e `id` \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f `Int` (\u0447\u0438\u0441\u043b\u043e),<\/p>\n<p>  \/\/ \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043a\u043d\u0446\u0438\u0438 `Number()`<\/p>\n<p>  const post = await prisma.post.findUnique({<\/p>\n<p>  where: { id: Number(id) },<\/p>\n<p>  })<\/p>\n<p>  res.json(post)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <code>app.get('\/user\/:id\/drafts', async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c `id` \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { id } = req.params<\/p>\n<p>  \/\/ \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435:<\/p>\n<p>  \/\/ \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0441\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f,<\/p>\n<p>  \/\/ \u0437\u0430\u0442\u0435\u043c \u0438\u0445 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c<\/p>\n<p>  const drafts = await prisma.user.findUnique({<\/p>\n<p>  where: {<\/p>\n<p>  id: Number(id),<\/p>\n<p>  }<\/p>\n<p>  }).posts({<\/p>\n<p>  where: { published: false }<\/p>\n<p>  })<\/p>\n<p>  res.json(drafts)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438:<\/p>\n<p>  <code>app.get('\/feed', async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { searchString, skip, take, orderBy } = req.query<\/p>\n<p>  \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430<\/p>\n<p>  const or: Prisma.PostWhereInput = searchString ? {<\/p>\n<p>  OR: [<\/p>\n<p>  { title: { contains: searchString as string } },<\/p>\n<p>  { content: { contains: searchString as string } },<\/p>\n<p>  ],<\/p>\n<p>  } : {}<\/p>\n<p>  \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u044b \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u044b\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f<\/p>\n<p>  \/\/ \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f<\/p>\n<p>  const posts = await prisma.post.findMany({<\/p>\n<p>  where: {<\/p>\n<p>  published: true,<\/p>\n<p>  ...or<\/p>\n<p>  },<\/p>\n<p>  include: { author: true },<\/p>\n<p>  take: Number(take) || undefined,<\/p>\n<p>  skip: Number(skip) || undefined,<\/p>\n<p>  orderBy: {<\/p>\n<p>  updatedAt: orderBy as Prisma.SortOrder<\/p>\n<p>  },<\/p>\n<p>  })<\/p>\n<p>  res.json(posts)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  POST-\u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430:<\/p>\n<p>  <code>app.post(`\/post`, async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { title, content, authorEmail } = req.body<\/p>\n<p>  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0441\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `create`<\/p>\n<p>  \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043e\u0441\u0442 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 `User`<\/p>\n<p>  \/\/ \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a `email` \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u043e\u0441\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 `connect`<\/p>\n<p>  const result = await prisma.post.create({<\/p>\n<p>  data: {<\/p>\n<p>  title,<\/p>\n<p>  content,<\/p>\n<p>  author: { connect: { email: authorEmail } },<\/p>\n<p>  },<\/p>\n<p>  })<\/p>\n<p>  res.json(result)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <code>app.post(`\/signup`, async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { name, email, posts } = req.body<\/p>\n<p>  \/\/ \u0423 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<p>  const postData = posts?.map((post: Prisma.PostCreateInput) =&gt; {<\/p>\n<p>  return { title: post?.title, content: post?.content }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 `create` \u0434\u0432\u0430\u0436\u0434\u044b:<\/p>\n<p>  \/\/ \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u0432<\/p>\n<p>  const result = await prisma.user.create({<\/p>\n<p>  data: {<\/p>\n<p>  name,<\/p>\n<p>  email,<\/p>\n<p>  posts: {<\/p>\n<p>  create: postData<\/p>\n<p>  }<\/p>\n<p>  },<\/p>\n<p>  })<\/p>\n<p>  res.json(result)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  PUT-\u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  \u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0430:<\/p>\n<p>  <code>app.put('\/publish\/:id', async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c `id` \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { id } = req.params<\/p>\n<p>  try {<\/p>\n<p>  \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0441\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c `id`<\/p>\n<p>  \/\/ \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435 `published` -<\/p>\n<p>  \/\/ \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 `select`<\/p>\n<p>  const postData = await prisma.post.findUnique({<\/p>\n<p>  where: { id: Number(id) },<\/p>\n<p>  select: {<\/p>\n<p>  published: true<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  \/\/ \u041c\u0435\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 `published` \u043d\u0430 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0435<\/p>\n<p>  \/\/ \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `update`<\/p>\n<p>  const updatedPost = await prisma.post.update({<\/p>\n<p>  where: { id: Number(id) },<\/p>\n<p>  data: { published: !postData?.published },<\/p>\n<p>  })<\/p>\n<p>  res.json(updatedPost)<\/p>\n<p>  } catch (error) {<\/p>\n<p>  \/\/ \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u0441\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c `id` \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442<\/p>\n<p>  res.json({ error: `\u041f\u043e\u0441\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c id ${id} \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d` })<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432 \u043f\u043e\u0441\u0442\u0430:<\/p>\n<p>  <code>app.put('\/post\/:id\/views', async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c `id` \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { id } = req.params<\/p>\n<p>  try {<\/p>\n<p>  \/\/ \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 `viewCount` \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 `increment: 1`, \u0433\u0434\u0435<\/p>\n<p>  \/\/ `increment` \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435, \u0430 `1` \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435<\/p>\n<p>  const post = await prisma.post.update({<\/p>\n<p>  where: { id: Number(id) },<\/p>\n<p>  data: {<\/p>\n<p>  viewCount: {<\/p>\n<p>  increment: 1<\/p>\n<p>  }<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  res.json(post)<\/p>\n<p>  } catch (error) {<\/p>\n<p>  \/\/ \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u0441\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c `id` \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442<\/p>\n<p>  res.json({ error: `\u041f\u043e\u0441\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c id ${id} \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d` })<\/p>\n<p>  }<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  DELETE-\u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0430:<\/p>\n<p>  <code>app.delete(`\/post\/:id`, async (req, res) =&gt; {<\/p>\n<p>  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c `id` \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/p>\n<p>  const { id } = req.params<\/p>\n<p>  \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u043e\u0441\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 `delete`<\/p>\n<p>  const post = await prisma.post.delete({<\/p>\n<p>  where: {<\/p>\n<p>  id: Number(id),<\/p>\n<p>  },<\/p>\n<p>  })<\/p>\n<p>  res.json(post)<\/p>\n<p>  })<\/p>\n<p>  <\/code><\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0430\u0448\u0435\u0433\u043e REST API \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430.<\/p>\n<p>  \u0421 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Prisma \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/prisma\/prisma-examples\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 API<\/h3>\n<p>  \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0433\u043e REST API. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/www.postman.com\/\">Postman<\/a>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 localhost \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 (desktop agent).<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <code>yarn dev<\/p>\n<p>  # \u0438\u043b\u0438<\/p>\n<p>  npm run dev<\/p>\n<p>  <\/code><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e63\/7aa\/146\/e637aa14661df2af5d82059c728d8cd1.png\"><\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/85b\/525\/4d2\/85b5254d258d33ba0279c8b90675755f.png\"><\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0441\u0442 \u0441 <code>id === 2<\/code>:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7bd\/1a5\/cae\/7bd1a5caec6ffe5c0a8cb882234c4009.png\"><\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/522\/7fe\/7ae\/5227fe7ae98ac3943f1a784bc9d58967.png\"><\/div>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a \u043e\u0442 \u043b\u0438\u0446\u0430 \u0411\u043e\u0431\u0430:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/d0f\/fe6\/53d\/d0ffe653da8417d0b787c0ba44795a7e.png\"><\/div>\n<p>  \u041f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u043d\u043e\u0432\u0438\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1a5\/96c\/6cb\/1a596c6cb2f2a8963d4bf2f629faa331.png\"><\/div>\n<p>  \u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bb7\/c3a\/186\/bb7c3a1866c621a1677eabd5d8bde23c.png\"><\/div>\n<p>  \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u043a\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u043e\u0431\u0437\u043e\u0440\u0430 Prisma ORM? \u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0411\u0414 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 SQL, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a <a href=\"https:\/\/sequelize.org\/\">Sequelize<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/typeorm.io\/#\/\">TypeORM<\/a>, Prisma \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u043a \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0411\u0414, \u0442\u0430\u043a \u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/mongoosejs.com\/\">Mongoose<\/a>, \u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0435\u0440\u0434\u0438\u043a\u0442, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Prisma \u043e\u0431\u0435\u0449\u0430\u044e\u0442 \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c <a href=\"https:\/\/github.com\/prisma\/prisma\/issues\/1277\">MongoDB connector<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 Prisma \u0438 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 Mongoose \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445, \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e Prisma \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0411\u0414, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0435 (include) \u0438 \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u0435 (select) \u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 GraphQL), \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0435\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c.<\/p>\n<p>  \u0412\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c, \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e Prisma \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0411\u0414. \u0420\u0435\u0447\u044c \u0438\u0434\u0435\u0442, \u0441\u043a\u043e\u0440\u0435\u0435, \u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043e\u0431 \u0438\u0445 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u0432 \u0440\u0443\u0441\u043b\u0435 \u0434\u043e\u043c\u0438\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439.<\/p>\n<hr>\n<p>  \u041d\u0430\u0448\u0438 <a href=\"https:\/\/macloud.ru\/?partner=4189mjxpzx\">\u0441\u0435\u0440\u0432\u0435\u0440\u044b<\/a> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 WebAssembly.<\/p>\n<p>  \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435\u0441\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432\u044b\u0448\u0435 \u0438\u043b\u0438 \u043a\u043b\u0438\u043a\u043d\u0443\u0432 \u043d\u0430 \u0431\u0430\u043d\u043d\u0435\u0440 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 10% \u0441\u043a\u0438\u0434\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0441\u044f\u0446 \u0430\u0440\u0435\u043d\u0434\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438!<\/p>\n<p>  <a href=\"https:\/\/macloud.ru\/?partner=4189mjxpzx&amp;utm_source=habr&amp;utm_medium=original&amp;utm_campaign=agapov\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/et\/1a\/yp\/et1aypandyuamqprsz3m2ntm4ky.png\"><\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/macloud\/blog\/554952\/\"> https:\/\/habr.com\/ru\/company\/macloud\/blog\/554952\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vx\/k5\/9q\/vxk59qa3zzqpy_maac9wkyp_yc8.png\"><\/p>\n<p>  \u042d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f-\u043e\u0431\u0437\u043e\u0440 \u043e <a href=\"https:\/\/www.prisma.io\/\">Prisma ORM<\/a>.<\/p>\n<p>  ORM (\u0430\u043d\u0433\u043b. Object-Relational Mapping \u2014 \u00ab\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u00bb) \u2014 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u00ab\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0442.\u043f.) \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. Prisma \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043c\u0435\u0441\u0442\u043e SQL.<\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Prisma?<\/h2>\n<p>  \u041a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, Prisma \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u00ab\u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e ORM \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f Node.js \u0438 TypeScript\u00bb, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0443\u044e \u00ab\u043d\u043e\u0432\u0443\u044e \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u00bb.<\/p>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>JavaScript<\/li>\n<li>TypeScript<\/li>\n<li>Go (\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435)<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322296","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=322296"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322296\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}