This file contains 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
module.exports = function(app) { | |
if (typeof app.channel !== 'function') { | |
// If no real-time functionality has been configured just return | |
return; | |
} | |
app.on('connection', connection => { | |
// On a new real-time connection, add it to the anonymous channel | |
app.channel('anonymous').join(connection); | |
}); |
This file contains 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 Sequelize = require('sequelize'); | |
const { Op } = Sequelize; | |
const operatorsAliases = { | |
$eq: Op.eq, | |
$ne: Op.ne, | |
$gte: Op.gte, | |
$gt: Op.gt, | |
$lte: Op.lte, | |
$lt: Op.lt, |
This file contains 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
import React from 'react'; | |
import {Switch,Route,Redirect} from 'react-router-dom' | |
import {Button} from 'semantic-ui-react' | |
import PropTypes from 'prop-types' | |
import PrivatePage from './PrivatePage' | |
import LoginPage from './LoginPage' | |
import client from './feathers' | |
import WithAuthentication from './WithAuthentication' | |
const App = () => ( |
This file contains 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
import React,{Component} from 'react' | |
import PropTypes from 'prop-types' | |
import client from './feathers' | |
async function getUserIdFromJwtTocken() { | |
try { | |
const token = localStorage.getItem('feathers-jwt'); | |
// console.log('token: ',token) | |
const payload = await client.passport.verifyJWT(token); | |
console.log('payload: ',payload) |
This file contains 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
// src/StockTable.js | |
import React from 'react' | |
import { Container,Divider,Header,Table,Button} from 'semantic-ui-react'; | |
import {Link} from 'react-router-dom' | |
import moment from 'moment' | |
import WithCrossCuttingConcerns from './WithCrossCuttingConcerns' | |
function StockTable(){ | |
const computeRunningCost = (thisProduct,products)=>{ |
This file contains 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
// src/DisplayGrid.js | |
import React from 'react' | |
import { Container,Divider,Header,Card,Button } from 'semantic-ui-react'; | |
import {Link} from 'react-router-dom' | |
import WithCrossCuttingConcerns from './WithCrossCuttingConcerns' | |
const DisplayGrid = () =>( | |
<Container textAlign='center'> | |
<Divider section hidden/> | |
<Header> Display Grid</Header> |
This file contains 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
// src/WithCrossCuttingConcerns.js | |
import React,{Component} from 'react' | |
import PropTypes from 'prop-types' | |
import client from './feathers' | |
class WithCrossCuttingConcerns extends Component{ | |
state={ | |
products:[], | |
} |
This file contains 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
host = 'localhost' | |
dialect = 'mysql' | |
database = 'myapp-db' | |
port = 3306 | |
user = 'root' | |
pwd = '' |
This file contains 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 Sequelize = require('sequelize'); | |
... | |
module.exports = function (app) { | |
const {dialect,host,user,pwd,database,port}=process.env; | |
const connectionString = `${dialect}://${user}:${pwd}@${host}:${port}/${database}`; | |
const sequelize = new Sequelize(connectionString, { | |
dialect: 'mysql', | |
logging: false, | |
operatorsAliases, |
This file contains 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
// src/models/products.model.js | |
// See http://docs.sequelizejs.com/en/latest/docs/models-definition/ | |
// for more of what you can do here. | |
const Sequelize = require('sequelize'); | |
const DataTypes = Sequelize.DataTypes; | |
module.exports = function (app) { | |
const sequelizeClient = app.get('sequelizeClient'); | |
const products = sequelizeClient.define('products', { | |
id: { |