Skip to content

Instantly share code, notes, and snippets.

/**
* Sid Barrack
*
* the issues identified are commented below with the correct implementation
*/
import { Suspense, useState, useEffect } from 'react';
/*
data needs to be outside of the component, because once the promise resolves(see comment on data loading component below),
//loading modules
const cheerio = require('cheerio');
const puppeteer = require('puppeteer');
const {Cluster} = require('puppeteer-cluster');
const XLSX = require('xlsx');
(async () => {
//launching the browser in full mode using headless : false
const browser = await puppeteer.launch({
headless: false
});
@da7a90
da7a90 / app.js
Last active September 25, 2019 11:44
simple authentication for beginners in NodeJS
const express = require('express');
const bodyParser = require('body-parser');
const session = require('express-session');
const app = express();
// Configuring the database
const dbConfig = require('./database.config.js');
const mongoose = require('mongoose');
const User = require('./model')
@da7a90
da7a90 / model.js
Created September 25, 2019 11:24
User model for simple NodeJS authentication
const mongoose = require('mongoose');
var userSchema = mongoose.Schema({
email : String,
password : String,
role : String
});
var User = mongoose.model('User', userSchema);