5分でNodeJSとPostgresで高速オートGraphicalサーバーを作る!
こんにちは世界!
あまりにも多くの私の最後のポストで大好き
今日、私はあなたに5分でNODEJSとPostgresデータベースで速い自動スキーマGraphicalサーバを取り付ける方法を示します.
最初のものはDockerでマウントPostgresデータベースです!
dbeaverに接続してみると良いPostgres UIツールです
https://dbeaver.io/
さあ!
NodeJSプロジェクトのフォルダを作成する
PostGraileはPostgresの構造に基づいて、GraphSQLを自動スキーマ化するのに非常に良いツールです.
あなたのGraphSQL自動スキーマ遊び場へようこそ!
GraphSQLリクエストの終点は
http://localhost:4000/graphql
あなたのフィードバックのおかげで!
あまりにも多くの私の最後のポストで大好き
今日、私はあなたに5分でNODEJSとPostgresデータベースで速い自動スキーマGraphicalサーバを取り付ける方法を示します.
最初のものはDockerでマウントPostgresデータベースです!
docker run --name mydb-postgres -e POSTGRES_PASSWORD=12345 -p 5432:5432 -d postgres
(デフォルトのユーザは以下の通りです: Postgres、デフォルトDBはPostgresです).dbeaverに接続してみると良いPostgres UIツールです
https://dbeaver.io/
さあ!
NodeJSプロジェクトのフォルダを作成する
mkdir awesome-graphql-server
cd awesome-graphql-server
NPMパッケージnpm init
エクスプレスエクスプレスPostGraileはPostgresの構造に基づいて、GraphSQLを自動スキーマ化するのに非常に良いツールです.
npm install express
npm install postgraphile
それで、あなたのインデックスに挿入しなければならない単純なコードです.jstouch index.js
nano index.js
インサート中var express = require('express');
const {
postgraphile
} = require("postgraphile");
var app = express();
app.use(
postgraphile(
process.env.DATABASE_URL || "postgres://postgres:[email protected]:5432/postgres",
"public", {
watchPg: true,
graphiql: true,
enhanceGraphiql: true,
}
)
);
app.listen(4000, () => console.log('go to for playground graphiql http://localhost:4000/graphiql'))
起動後node index.js
そして、http://localhost:4000/graphiqlに行くあなたのGraphSQL自動スキーマ遊び場へようこそ!
GraphSQLリクエストの終点は
http://localhost:4000/graphql
あなたのフィードバックのおかげで!
Reference
この問題について(5分でNodeJSとPostgresで高速オートGraphicalサーバーを作る!), 我々は、より多くの情報をここで見つけました https://dev.to/simerca/make-a-fast-auto-graphql-server-with-nodejs-and-postgres-in-5-minutes-146hテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol