Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
// sending to sender-client only | |
socket.emit('message', "this is a test"); | |
// sending to all clients, include sender | |
io.emit('message', "this is a test"); | |
// sending to all clients except sender | |
socket.broadcast.emit('message', "this is a test"); | |
// sending to all clients in 'game' room(channel) except sender |
Using JSON in Postgres by example.
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
import React from 'react' | |
import { withRouter, Link } from 'react-router-dom' | |
import { graphql, compose } from 'react-apollo' | |
import { Formik } from 'formik' | |
import Yup from 'yup' | |
import FormWideError from '../elements/form/FormWideError' | |
import TextInput from '../elements/form/TextInput' | |
import Button from '../elements/form/Button' | |
import { H2 } from '../elements/text/Headings' |
import 'package:flutter/material.dart'; | |
import 'package:simple_inherit/state_container.dart'; | |
class UpdateUserScreen extends StatelessWidget { | |
static final GlobalKey<FormState> formKey = new GlobalKey<FormState>(); | |
static final GlobalKey<FormFieldState<String>> firstNameKey = | |
new GlobalKey<FormFieldState<String>>(); | |
static final GlobalKey<FormFieldState<String>> lastNameKey = | |
new GlobalKey<FormFieldState<String>>(); | |
static final GlobalKey<FormFieldState<String>> emailKey = |
body { | |
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; | |
} |
import * as firebase from 'firebase/app'; | |
import 'firebase/firestore'; | |
var firebaseConfig = { | |
// your firebase credentials | |
}; | |
// Initialize Firebase | |
firebase.initializeApp(firebaseConfig); |
<!-- Copyright 2011 the Dart project authors. All rights reserved. | |
Use of this source code is governed by a BSD-style license | |
that can be found in the LICENSE file. --> | |
<h2>Dr. Fibonacci's Sunflower Spectacular</h2> | |
<div> | |
<canvas id="canvas" width="300" height="300"></canvas> | |
</div> |
"eslint.validate": [ | |
"javascript", | |
"javascriptreact", | |
{ "language": "typescript", "autoFix": true }, | |
{ | |
"language": "typescriptreact", | |
"autoFix": true | |
} | |
], |
Put the docker-compose.yaml
into a new folder, along with a folder called /migrations
. Put the sample SQL in there at /migrations/any-name.sql
. This will seed the MySQL DB on startup.
Run docker-compose up -d
, and visit Hasura at http://localhost:8080
Note: If you would like to a connect to an existing MySQL DB running outside of Docker on localhost
, you will need to edit the configuration for the Hasura service so that it uses host
networking. Then use localhost
for the --mysql-host
argument. Also, in order for Hasura on localhost
to connect to the Docker Postgres instance, you'll need to add 5432:5432
to the service port
configurations for postgres
so that it's exposed, then change the DB URL to postgres://postgres:postgrespassword@localhost:5432/postgres
.
services:
graphql-engine:
# ...