-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
54 lines (44 loc) · 1.29 KB
/
server.js
File metadata and controls
54 lines (44 loc) · 1.29 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
45
46
47
48
49
50
51
52
53
54
'use strict';
/**************************************
* Require built-in node module like `http`
* Note the non-relative path ('http')
*/
const http = require('http');
console.log(http.METHODS);
console.log(http.STATUS_CODES);
console.log(http.STATUS_CODES[418]); //=> "I'm a teapot"
/**************************************
* Require npm installed packages like `express`
* Again, note the non-relative path ('express')
*/
const express = require('express');
console.log(express);
for (let prop in express) {
console.log(prop);
}
/**************************************
* Require a simple module in a **FILE**
* Note:
* the relative path ('./hello-file')
* no `.js` extension needed
*/
var helloFile = require('./hello-file');
console.log(helloFile);
/**************************************
* Require a simple module in a **FOLDER**
* Note:
* the relative path ('./hello-folder')
* no `index.js` needed since it's loaded by default
*/
var helloFolder = require('./hello-folder');
console.log(helloFolder);
/**
* Require a commonjs module with multiple exports
* Note: the relative path ('./models/storage')
* Note: `index.js` is not specified since it's loaded by default
*/
const { create, read, update, remove } = require('./models/storage');
create();
read();
update();
remove();