Skip to content

Commit

Permalink
Merge pull request #8 from oslabs-beta/login-page
Browse files Browse the repository at this point in the history
installed/imported electron-fetch to login page and set up server file to listen to port 3000
  • Loading branch information
charcharryu authored Jun 10, 2021
2 parents f50561d + 085f2c9 commit 487a46b
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "MIT",
"description": "A Docker Visualizer",
"author": "Team Docketeer",
"proxy": "http://localhost:3000",
"scripts": {
"dev": "NODE_ENV=development electron-webpack dev",
"compile": "electron-webpack",
Expand Down Expand Up @@ -34,6 +35,7 @@
"cross-env": "^7.0.2",
"css-loader": "^4.2.2",
"electron-chartjs": "^1.0.0",
"electron-fetch": "^1.7.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.4",
"enzyme-to-json": "^3.5.0",
Expand Down
55 changes: 55 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const path = require('path');
const express = require('express');
const app = express();
const PORT = 3000;

app.use(express.json());

app.use(express.urlencoded({ extended: true }));







app.get('/', (req, res, next)=>{

res.status(200).json('whatchu du (Husker du)');
})



// reformat
// app.post( , (req, res, next)=>{

// path.join(__dirname, )

// res.status(200).json();
// })

app.get('/', (req, res, next, err)=> {

console.error('You are mistaken', err);
})













app.listen(PORT, ()=> {
console.log(`server is listening on port ${PORT}`)
});




module.exports = app;
16 changes: 14 additions & 2 deletions src/components/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Modal from "react-modal";
import { BrowserRouter as Router, Switch, Route, Redirect } from "react-router-dom";
import App from '../App';
import SignupModal from './signupModal';
import fetch from 'electron-fetch';

const Login = () => {
useEffect(() => {
Expand All @@ -11,11 +12,22 @@ const Login = () => {

const [ loggedIn, setLoggedIn ] = useState(false);
const [ modalIsOpen, setIsOpen ] = useState(false);
.

const openModal = () => setIsOpen(true);
const closeModal = () => setIsOpen(false);


// fetch('http://www.google.com')
// .then((response)=>{
// console.log(response);
// return response.json();
// }).then((data)=>{
// console.log('next one');
// console.log('big BIG DATA', data);
// }).catch((err)=>{
// console.error('dis is baaad man(error)', err)
// })
// change what you need

const handleClick = (e) => {
e.preventDefault();
const username = document.getElementById('username').value;
Expand Down
3 changes: 3 additions & 0 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { app, BrowserWindow, ipcMain } from "electron";
import * as path from "path";
import { format as formatUrl } from "url";
import server from "../../server/server.js";


import verifyCode from "./twilio/verifyCode";
import verifyMobileNumber from "./twilio/verifyMobile";
Expand Down Expand Up @@ -70,6 +72,7 @@ app.on("activate", () => {

// create main BrowserWindow when electron is ready
app.on("ready", () => {
// server;
mainWindow = createMainWindow();
});

Expand Down

0 comments on commit 487a46b

Please sign in to comment.