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
export const validateToken = (url) => { | |
return dispatch => { | |
let token = null, email = null; | |
if(localStorage.getItem("token")){ | |
token = localStorage.getItem("token"); | |
email = localStorage.getItem("email"); | |
} | |
if(token){ | |
axios.post("/simple-jwt-authentication/v1/token/validate", {},{headers: {"Authorization": "Bearer " + token}}).then(res => { | |
if(res.data.data.status === 200){ |
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
{ | |
..., | |
multiValueHeaders: | |
{ | |
Host: [ 'myapiID.execute-api.ap-south-1.amazonaws.com' ], | |
'Sec-WebSocket-Extensions': [ 'permessage-deflate; client_max_window_bits' ], | |
'Sec-WebSocket-Key': [ 'mNRIjuK+dWTWDS8VCYeuyg==' ], | |
'Sec-WebSocket-Version': [ '13' ], | |
'X-Amzn-Trace-Id': [ 'Root=1–abc–xyz' ], | |
'X-Forwarded-For': [ 'my public IP' ], |
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
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
let db = null; | |
//Initialize connection to MongoDB | |
module.exports.initMongo = async () => { | |
return new Promise((resolve, reject) => { | |
// I set up environment variables for my lambda to allow easy change. This is useful | |
// since I stop / start my EC2 instance often. | |
// In my case MONGO_HOST is the private IP of my EC2 instance, since I'm using VPC peering |
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
{ | |
"name": "RC-Chat", | |
"dependencies": { | |
"@material-ui/core": "^3.9.3", | |
"@material-ui/icons": "^3.0.2", | |
"@types/react": "^16.8.14", | |
"@types/react-dom": "^16.8.4", | |
"dotenv": "^8.0.0", | |
"isomorphic-ws": "^4.0.1", | |
"jsdoc": "^3.5.5", |
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 WebSocket from 'isomorphic-ws'; | |
const WS_URL = process.env.REACT_APP_WEBSOCKET_URL || ""; | |
let WSService = null; | |
class WebSocketService { | |
constructor() { | |
this.websocket = null; |
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, { useState, useEffect } from "react"; | |
import Grid from "@material-ui/core/Grid"; | |
import { | |
createStyles, | |
Theme, | |
WithStyles, | |
withStyles, | |
Typography, | |
Button | |
} from "@material-ui/core"; |
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 path from 'path'; | |
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import express from 'express'; | |
//My HTML wrapper component where I insert the string returned | |
// by renderToString() | |
import Html from './html'; | |
// The basic App component used by our React application | |
import App from '../src/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
const path = require('path'); | |
// To prevent node_modules from being bundled into our final build file | |
const nodeExternals = require('webpack-node-externals'); | |
module.exports = { | |
entry: path.resolve(__dirname, 'server', 'server.js'), | |
output: { | |
path: path.resolve(__dirname, 'build'), | |
filename: 'server.js' | |
}, |
OlderNewer