This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "server", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "src/index.js", | |
| "scripts": { | |
| "start": "node src/index.js", | |
| "watch": "nodemon src/index.js" | |
| }, | |
| "author": "Pratik Agashe", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config() | |
| const cors = require('cors') | |
| const express = require('express') | |
| const bodyParser = require('body-parser') | |
| const app = express() | |
| const { PORT } = process.env | |
| app.use(cors()) | |
| app.use(bodyParser.json()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CLIENT=pg | |
| PORT=8080 | |
| DATABASE=postgres-graphql | |
| PG_USER=postgres | |
| PASSWORD=root | |
| HOST=127.0.0.1 | |
| PG_PORT=5432 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('dotenv').config() | |
| const { CLIENT, DATABASE, PG_USER, PASSWORD, HOST, PG_PORT } = process.env | |
| module.exports = { | |
| development: { | |
| client: CLIENT, | |
| connection: { | |
| database: DATABASE, | |
| user: PG_USER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const environment = process.env.NODE_ENV || 'development' | |
| const config = require('../knexfile')[environment] | |
| module.exports = require('knex')(config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.up = function(knex) { | |
| return knex.schema | |
| .createTable('users', function(table) { | |
| table.increments().primary() | |
| table.string('name', 255).notNullable() | |
| table.string('email', 255).notNullable() | |
| table.string('password', 255).notNullable() | |
| table | |
| .boolean('account_verified') | |
| .notNullable() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.seed = function(knex) { | |
| // Deletes ALL existing entries | |
| return knex('users') | |
| .del() | |
| .then(function() { | |
| // Inserts seed entries | |
| return knex('users').insert([ | |
| { | |
| id: 1, | |
| name: 'Pratik Agashe', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.seed = function(knex) { | |
| // Deletes ALL existing entries | |
| return knex('posts') | |
| .del() | |
| .then(function() { | |
| // Inserts seed entries | |
| return knex('posts').insert([ | |
| { | |
| id: 1, | |
| title: 'Sample blog', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()) |
OlderNewer