chore(postgraphile-heady): initial commit
This commit is contained in:
parent
28cbeee2d8
commit
02f9720d35
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
node_modules
|
|
@ -0,0 +1,15 @@
|
|||
require('dotenv').config()
|
||||
const cors = require('cors')
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
const app = express()
|
||||
const postgraphile = require('./postgraphile')
|
||||
|
||||
const { PORT } = process.env
|
||||
|
||||
app.use(cors())
|
||||
app.use(bodyParser.json())
|
||||
app.use(bodyParser.urlencoded({ extended: false }))
|
||||
app.use(postgraphile)
|
||||
|
||||
app.listen(PORT, () => console.log(`Server running on port ${PORT}`))
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "postgraphile",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"dev": "nodemon src/index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Stefan Begerad",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"body-parser": "1.20.2",
|
||||
"cors": "2.8.5",
|
||||
"express": "4.18.3",
|
||||
"pg": "8.11.3",
|
||||
"postgraphile": "4.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dotenv": "16.4.5",
|
||||
"nodemon": "3.1.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
const { postgraphile } = require('postgraphile')
|
||||
|
||||
const { DATABASE, PG_USER, PASSWORD, HOST, PG_PORT } = process.env
|
||||
|
||||
module.exports = postgraphile(
|
||||
{
|
||||
database: DATABASE,
|
||||
user: PG_USER,
|
||||
password: PASSWORD,
|
||||
host: HOST,
|
||||
port: PG_PORT,
|
||||
},
|
||||
'public',
|
||||
{
|
||||
watchPg: true,
|
||||
graphiql: true,
|
||||
enhanceGraphiql: true,
|
||||
}
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
[link](https://www.heady.io/blog/part-1-building-full-stack-web-app-with-postgraphile-and-react-server-side)
|
||||
|
||||
* foo
|
||||
```
|
||||
ssh -N -L 5432:localhost:5432 -p 22 zvbn_nvp@83.223.91.130
|
||||
npm i
|
||||
npm run dev
|
||||
```
|
||||
|
||||
* open in browser
|
||||
```
|
||||
http://localhost:8080/graphiql
|
||||
```
|
Loading…
Reference in New Issue