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
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
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
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 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
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
// 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
// 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
// we need this module to create the server and handel the request from the user | |
const http = require('http'); | |
// here is the host where the server will work | |
const hostname = '127.0.0.1'; | |
// you can use any port but the likely for node.js is 3000 | |
const port = 3000; | |
// here is a call back function we will talk about it later but this function called when the user requset the server URL | |
const server = http.createServer((req, res) => { |
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 http = require('http'); | |
const hostname = '127.0.0.1'; | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
res.statusCode = 200; | |
res.setHeader('Content-Type', 'text/plain'); | |
res.end('Hello, World!\n'); | |
}); |