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
    
  
  
    
  | // in the controller controller.js | |
| module.export = function(app){ | |
| } | |
| // in the app.js | |
| var express = require('express'); | |
| var controller = require('./controller/controller.js'); | |
| .. | 
  
    
      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
    
  
  
    
  | // in the controller.js handel the user reactions | |
| module.export = function(app){ | |
| app.get('/AppName', function(req, res){ | |
| res.render('mainAppPage'); | |
| }); | |
| }; | |
| // in the views/mainAppPage.ejs | |
| our html tamplate | 
  
    
      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 app = require('express')(); | |
| var http = require('http').createServer(app); | |
| var io = require('socket.io')(http); | |
| const hostname = '192.168.56.1'; | |
| const port = 3001; | |
| app.get('/', (req, res) =>{ | |
| res.sendFile(__dirname+'/server.html'); | |
| }); | 
  
    
      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'); | |
| mongoose.connect( | |
| 'mongodb://username:password@host/databasename', {useNewUrlParser: true} | |
| ); | |
| const db = mongoose.connection; | |
| db.on('error', console.error.bind(console, 'connection error:')); | |
| db.once('open', function () { | 
  
    
      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 userSchema = mongoose.Schema({ | |
| "id": Number, | |
| "username": String, | |
| "paswod": String, | |
| "name": String, | |
| "last_name": String | |
| }); | |
| var user = mongoose.model('users', userSchema); | 
  
    
      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 app = require('express')(); | |
| const http = require('http').createServer(app); | |
| const io = require('socket.io')(http); | |
| const userFunctions = require('./userFunctions') | |
| const hostname = '192.168.56.1'; | |
| const port = 3001; | |
| io.on('connection', function (socket) { | |
| console.log('a user connected'); | 
  
    
      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 registerNeuUser(data){ | |
| userName = data.userName; | |
| firstName = data.firstName; | |
| lastName = data.lastName; | |
| email = data.email; | |
| password = data.password; | |
| birthDay = data.birthDay; | |
| //log the registered user | |
| console.log('++++++++++ New-User +++++++++++++\n' + | 
  
    
      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
    
  
  
    
  | YouTube iframe: | |
| <iframe | |
| width="560" | |
| height="315" | |
| src="https://www.youtube.com/embed/videoseries?list=PLx0sYbCqOb8TBPRdmBHs5Iftvv9TPboYG" | |
| frameborder="0" | |
| allow="autoplay; encrypted-media" | |
| allowfullscreen> | |
| </iframe> | 
  
    
      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
    
  
  
    
  | public static function postRequest($url, $postData, $headers){ | |
| //init curl: | |
| $ch = curl_init($url); | |
| // Configuring curl options | |
| $options = array( | |
| CURLOPT_CUSTOMREQUEST => 'POST', | |
| CURLOPT_RETURNTRANSFER => true, | |
| CURLOPT_POSTFIELDS => $postData, | |
| CURLOPT_HTTPHEADER => $headers | |
| ); | 
  
    
      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
    
  
  
    
  | // Ex: create category container | |
| /// add the consts in data obj can be not definde just the type is requseted | |
| const catContainer = htmlE({ | |
| type: 'div', // type of the element | |
| classes: 'first-class second-class', // css classes | |
| id: elementId, // element id | |
| container: container, // parent container to append to | |
| onClick: catClick, // on element click function | |
| params: [category] // on element click function params | |
| }); |