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
| function Stopwatch(){ | |
| let startTime | |
| let isRunning = false | |
| let endTime | |
| this.start = function(){ | |
| if(isRunning === true){ | |
| console.log('Stopwatch already running') | |
| }else{ | |
| startTime = new Date() | |
| isRunning = true |
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
| const mongoose = require('mongoose'); | |
| const Schema = mongoose.Schema; | |
| const FormGroupSchema = new Schema({ | |
| userid: {type: Schema.Types.ObjectId, ref:'User', required:true}, | |
| formid: {type: Schema.Types.ObjectId, ref:'Form', default: null}, | |
| status: {type: Boolean, default: false, required: true} | |
| }) | |
| const TestSchema = new Schema({ |
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
| Chrome | |
| Access to fetch at 'http://localhost:9000/login' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'localhost:3000/#/login' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. | |
| Firefox | |
| Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:9000/login. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘localhost:3000/#/login’). | |
| Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:9000/login. (Reason: CORS request did not succeed). |
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
| const LocalStrategy = require('passport-local').Strategy; | |
| const bcrypt = require('bcryptjs'); | |
| const User = require('../models/user'); | |
| function initialize(passport, getUserById) { | |
| const getUserByUsername = async function(username){ | |
| User.find({username:username}).exec(function(err, results){ | |
| if(err){return next(err);} |
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
| const Player = (name, age) =>{ | |
| const getName = () => name; | |
| const getAge = () => age; | |
| return {getName, age}; | |
| }; | |
| const gameBoard = ( () =>{ | |
| let currentPlayer = ""; | |
| let allPlayer = []; | |
| let board = []; |