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
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import "./index.css"; | |
import App from "./App"; | |
ReactDOM.render(<App />, document.getElementById("root")); |
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
import React from 'react'; | |
import { Route, Redirect } from 'react-router-dom'; | |
const PrivateRoute = ({component: Component, ...rest}) => { | |
return ( | |
<Route {...rest} render={props => ( | |
localStorage.getItem('auth') ? | |
<Component {...props} /> | |
: <Redirect to="/login" /> | |
)} /> |
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
git clone https://github.com/cometchat-pro/cometchat-pro-react-ui-kit.git |
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
var http = require("http"); | |
var fs = require("fs"); | |
var path = require("path"); | |
const APP_PORT = process.env.APP_PORT || 3000; | |
const app = http.createServer(requestHandler); | |
app.listen(APP_PORT); | |
console.log(`🖥 HTTP Server running at ${APP_PORT}`); | |
// handles all http requests to the server |
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
// FILE /client/chat.js | |
console.log("chat.js file loaded!"); | |
// IMPORTANT! By default, socket.io() connects to the host that | |
// served the page, so we dont have to pass the server url | |
var socket = io.connect(); | |
//prompt to ask user's name | |
const username = prompt("Welcome! Please enter your name:"); |
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
// FILE /client/chat.js | |
console.log("chat.js file loaded!"); | |
// IMPORTANT! By default, socket.io() connects to the host that | |
// served the page, so we dont have to pass the server url | |
var socket = io.connect(); | |
//prompt to ask user's name | |
const username = prompt("Welcome! Please enter your name:"); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Chat app</title> | |
<script | |
src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.1/socket.io.js" | |
integrity="sha512-oFOCo2/3DtjrJG4N27BjSLQWoiBv171sK6a+JiWjp/7agxC2nCUP358AqzxkBUb5jX8g6CYLPdSKQTbC0weCwA==" | |
crossorigin="anonymous" |
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
// FILE /client/chat.js | |
console.log("chat.js file loaded!"); | |
// IMPORTANT! By default, socket.io() connects to the host that | |
// served the page, so we dont have to pass the server url | |
var socket = io.connect(); | |
//prompt to ask user's name | |
const username = prompt("Welcome! Please enter your name:"); |
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
/ FILE /client/chat.js | |
console.log('chat.js file loaded!') | |
// IMPORTANT! By default, socket.io() connects to the host that | |
// served the page, so we dont have to pass the server url | |
var socket = io.connect() |
NewerOlder