-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
44 lines (37 loc) · 1.02 KB
/
main.js
File metadata and controls
44 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const express = require('express');
const main = express();
const PORT = 3000;
main.use(express.json());
main.use('/', (req, res) => {
//simple datatypes, arrays
// const arr = ['tshewang', 'gyaltshen', 'error', 1];
// const user = {
// name: "phurpa",
// email: "phurpa@gmail.com",
// company: "newegde.bt"
// }
// what is constructor function, simple functions that has capital
function Person(firstName, birthYear) {
this.firstName = firstName;
this.birthYear = birthYear;
}
const yanchen = new Person('yangchen', 1020);
console.log(yanchen);
console.log('this')
// console.log(Person.firstName);
res.status(200).json({
message: "get all the messages"
})
})
main.listen(PORT, () => {
console.log(`The server is running on port ${PORT}`);
})
// main practice of the oop concepts in javascript
/*
1.construtor functions,
2.protoype inheritance
3.class
4. methods and property
5. Object.create
6. objects
*/