This file contains 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
//installation process | |
npm init -y | |
npm install mongoose | |
npm install express | |
npm i --save-dev nodemon - package.json - scripts - “start”:”nodemon index.js” | |
create a file - index.js | |
//step 1 | |
const express = require('express'); | |
const app = express() |
This file contains 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 express = require('express') | |
const app = express(); // execute express | |
app.get('', (req, res)=>{ // get or post method | |
res.send('Hello, Sunday School -- home page') | |
}) | |
app.get('/about', (req, res)=>{ | |
res.send('Hello, Sunday School -- about page') | |
}) | |
app.listen(8080) |
This file contains 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
//js executed in the sequence they are called | |
function myFirst() { | |
myDisplayer("Hello"); | |
} | |
function mySecond() { | |
myDisplayer("Goodbye"); | |
} | |
myFirst(); |
This file contains 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 nodemailer = require('nodemailer'); | |
// var transporter = nodemailer.createTransport({ | |
// service: 'gmail', | |
// auth: { | |
// user: 'youremail@gmail.com', | |
// pass: 'yourpassword' | |
// } | |
// }); |
This file contains 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
import re | |
import random | |
# define a function to generate responses | |
def get_response(user_input): | |
# convert user input to lowercase | |
user_input = user_input.lower() | |
# extract information using regular expressions | |
match = re.search(r'hi|hello|hey', user_input) |
This file contains 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
//index.html | |
<body> | |
<h1>Winter</h1> | |
<p>I love the snow!</p> | |
</body> | |
//read file | |
var http = require('http'); | |
var fs = require('fs'); | |
http.createServer(function (req, res) { |
This file contains 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
// ******** Basic ******** | |
function functionName(param1, param2, ...) { | |
// code to be executed | |
} | |
// ******** Function Expression ******** | |
var x = function (a, b) { return a * b }; | |
var z = x(4, 3); |
This file contains 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 Hello = () => { | |
return ( | |
<> | |
<h2>This is Function component</h2> | |
</> | |
) | |
} | |
export default Hello; |
This file contains 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
import React from 'react'; | |
class Hello extends React.Component { | |
render() { | |
return ( | |
<> | |
<h2>This is class component</h2> | |
</> | |
) | |
} |
This file contains 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
export const incrementNumber = () => { | |
return{ | |
type: 'INCREMENT' | |
} | |
} | |
export const decrementNumber = () => { | |
return{ | |
type: 'DECREMENT' | |
} |
NewerOlder