728x90

Prisma와 Nexus는 모두 GraphQL 개발을 보다 쉽고 간편하게 할 수 있도록 도와주는 도구입니다.

그러나 두 도구는 서로 다른 목적과 기능을 가지고 있으며, 서로 다른 역할을 합니다.

 

Prisma는 데이터베이스 ORM(Object-Relational Mapping)으로, 데이터 모델과 데이터베이스 스키마를 정의하고 데이터베이스에 접근할 수 있는 API를 제공합니다. Prisma는 데이터베이스 스키마를 정의하기 위해 prisma/schema.prisma 파일을 사용하며, 이를 통해 데이터 모델을 작성하고 데이터베이스를 마이그레이션하는 작업을 할 수 있습니다.

 

반면에 Nexus는 GraphQL 스키마를 코드 기반으로 작성하고 구성하는 도구입니다.

Nexus는 GraphQL API를 작성하기 위해 사용되며, Prisma에서 생성된 데이터베이스 API를 사용하거나 다른 데이터 소스로부터 데이터를 가져와 GraphQL API를 구성할 수 있습니다.

 

따라서 Prisma와 Nexus는 각각의 목적과 기능을 가지고 있으며, 같이 사용할 수 있습니다. Prisma는 데이터베이스 ORM으로서 데이터베이스에 대한 접근을 쉽게 하고, Nexus는 GraphQL API를 작성하기 위한 도구로서 Prisma와 함께 사용하여 간편하게 GraphQL API를 구성할 수 있습니다. Prisma와 Nexus를 같이 사용하면 보다 쉽고 간편하게 GraphQL API를 구성할 수 있습니다.

728x90
728x90

nodejs 는 

chrome v8 javascrpit엔진으로 빌드된 javascript런타임이다.

 

( "자바스크립트 런타임"이란 "자바스크립트 코드를 실행하는 환경"을 말한다. 

자바스크립트는 일반적으로 브라우저에서 실행된다. 

다른 환경에서도 실행될 수 있지만 이를 위해서는 자바스크립트 엔진을 다른 프로그램에 내장하여 자바스크립트 코드를 실행할 수 있는 환경을 만들어야한다. 자바스크립트 엔진과 함께 필요한 라이브러리, 모듈, api 등을 포함하는 것이 자바스크립트 런타임이다. 

)

 

브라우저에서 실행되는 자바스크립트와 달리 nodejs 는 파일 시스템,네트워크 등과 같은

서버 사이드 기능을 제공하여, 서버 사이드 웹 개발을 위한 환경을 제공한다. 

이를 통해 *비동기식 I/O, 이벤트 기반 처리 모델 등을 활용해 높은 성능의 웹 애플리케이션을 만들 수 있다.

 

또한 노드js는 npm이라는 패키지 매니저를 제공한다. node package manager

이를 통해 라이브러리, 모듀르 프레임워크 등의 다양한 패키지를 쉽게 설치하고 관리할 수 있다.

 

 

(I/O(Input/Output)는 컴퓨터에서 데이터를 읽고 쓰는 작업을 말합니다. 이때, 데이터를 읽고 쓰는 과정에서 CPU는 다른 작업을 수행할 수 없는 차단(blocking) 상태에 빠지게 됩니다. 이러한 문제를 해결하기 위해 비동기식 I/O(Asynchronous I/O)가 등장했습니다.)

 

+

express는 

노드Js를 위한 웹 프레임워크이다. 간결하고 유연한 구조를 가지고 있는 것이 특징

노드js의 http 모듈을 기반으로하며, 

http 요청

라우팅 및 미들웨어 처리를 쉽게 할 수 있도록 한다.

 

다음과 같은 기능을 제공한다. 

  1. 라우팅: HTTP 요청의 URL을 해당하는 처리기(콜백 함수)에 매핑합니다. 이를 통해 사용자는 특정 URL에 대한 요청에 대한 적절한 응답을 반환할 수 있습니다.
  2. 미들웨어: 요청을 처리하기 전에 실행되는 작업을 구성할 수 있습니다. 예를 들어 요청 헤더의 유효성을 검사하거나 로깅을 수행하는 등의 작업을 수행할 수 있습니다. 또한 미들웨어를 사용하여 사용자 정의 라우팅 및 오류 처리 논리를 구현할 수도 있습니다.
  3. HTTP 요청 및 응답: Express는 HTTP 요청 및 응답을 쉽게 처리할 수 있는 기능을 제공합니다. 예를 들어 요청 본문을 구문 분석하거나 특정 상태 코드로 응답을 반환할 수 있습니다.
  4. 뷰 엔진: Express는 다양한 뷰 엔진을 지원합니다. 이를 통해 사용자는 HTML 및 CSS와 같은 마크업 언어로 페이지를 렌더링할 수 있습니다. 대표적인 뷰 엔진으로는 Pug, EJS, Handlebars 등이 있습니다.

 

728x90
728x90

GraphQL은 Facebook에서 개발하고 오픈 소스로 제공하는 API(애플리케이션 프로그래밍 인터페이스)용 쿼리 언어 및 런타임입니다. API 구축을 위해 REST(Representational State Transfer)에 대한 보다 효율적이고 강력하며 유연한 대안을 제공합니다.

GraphQL API에서 클라이언트는 필요한 데이터를 지정하는 요청을 하고 서버는 고정된 데이터 집합이 아닌 요청된 데이터만 반환합니다. 이렇게 하면 데이터를 과도하게 가져오거나 적게 가져오지 않고 필요한 데이터를 정확하게 검색하고 여러 요청이 아닌 단일 요청으로 데이터를 받을 수 있습니다.

GraphQL은 또한 클라이언트와 서버 간에 교환되는 데이터에 대한 유형 시스템을 제공하여 요청과 응답이 실행되기 전에 유효성을 검사할 수 있도록 합니다. 그 결과 성능이 향상되고 복잡성이 감소하며 API가 더 예측 가능해집니다.

GraphQL의 또 다른 주요 기능은 실시간 업데이트 및 구독 지원으로, 실시간 및 협업 애플리케이션 구축에 매우 적합합니다.

전반적으로 GraphQL은 API를 구축하는 보다 효율적이고 유연하며 강력한 방법을 제공하며 특히 여러 데이터 소스 및 서비스와 상호 작용해야 하는 모바일 및 웹 애플리케이션을 위한 최신 애플리케이션 개발에 널리 사용되는 선택이 되었습니다.

GraphQL is a query language and runtime for APIs (Application Programming Interfaces) that was developed and open-sourced by Facebook. It provides a more efficient, powerful, and flexible alternative to REST (Representational State Transfer) for building APIs.

In a GraphQL API, the client makes a request specifying the data it needs, and the server returns only the requested data, rather than a fixed set of data. This makes it possible to retrieve exactly the data you need, without over- or under-fetching data, and to receive the data in a single request, rather than multiple requests.

GraphQL also provides a type system for the data being exchanged between the client and the server, making it possible to validate the requests and responses before they are executed. This results in better performance, reduced complexity, and a more predictable API.

Another key feature of GraphQL is its support for real-time updates and subscriptions, which makes it well-suited for building real-time and collaborative applications.

Overall, GraphQL provides a more efficient, flexible, and powerful way to build APIs, and has become a popular choice for developing modern applications, especially for mobile and web applications that need to interact with multiple data sources and services.

728x90

'데이터베이스' 카테고리의 다른 글

러닝MySQL 2장 데이터베이스 모델링과 설계  (0) 2024.02.18
몽고디비 공부중..  (0) 2021.11.10
728x90

The error message ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database '' in MySQL indicates that the user root@localhost doesn't have sufficient privileges to access the database specified in the command.

Here are the steps to resolve the issue:

  1. Connect to the MySQL server with an administrative account:
 
`mysql -u root -p`
  1. Grant the required privileges to the user:
 
`GRANT ALL PRIVILEGES ON database_name.* TO 'root'@'localhost';`

Replace database_name with the name of the database you want to grant privileges to. The ALL PRIVILEGES clause grants all privileges to the user, including the ability to create, modify, and delete data in the database.

  1. Flush the privileges to make the changes take effect:
Copy code
FLUSH PRIVILEGES;
  1. Try accessing the database again and see if the error still occurs.

This should resolve the issue and allow the user root@localhost to access the specified database.

 

728x90
728x90

In the context of relational databases, the terms "database" and "schema" are often used interchangeably, but they have different meanings.

A database is a collection of related data stored in a specific and organized way, allowing for easy retrieval and management of the data. A database can contain multiple tables, views, and other database objects.

A schema is a logical container for organizing database objects, such as tables, views, indexes, procedures, and functions, within a database. A schema provides a way to organize the database objects in a logical and meaningful manner.

In other words, a schema can be thought of as a blueprint or blueprint plan of how the database is structured and how the data is organized within it. A database can contain multiple schemas, and each schema can contain multiple tables and other objects.

In short, a database is a physical container for storing data, while a schema is a logical container for organizing the database objects within that data.

728x90
728x90

To add a new user in MySQL, you can use the CREATE USER statement followed by the GRANT statement.

Here's an example of how to create a new user named "newuser" with the password "newpassword":

 
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'newpassword';

Once the user is created, you can grant them privileges using the GRANT statement. For example, to grant the SELECT, INSERT, and UPDATE privileges on a database named "testdb" to the new user, you can use the following command:

 
GRANT SELECT, INSERT, UPDATE ON testdb.* TO 'newuser'@'localhost';

Regarding the "root" user, it is the default administrative user in MySQL. The root user is created during the installation of MySQL and has the highest level of privileges, allowing it to perform any operation on the MySQL server, including creating and modifying users, granting and revoking privileges, and managing databases. The root user is usually created with a password, and you can log in to the MySQL server as the root user by specifying the username and password in the mysql client.

 

728x90

+ Recent posts