-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.mjs
34 lines (25 loc) · 1.17 KB
/
server.mjs
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
console.log('starting in server.mjs...');
// Here we use node's --experimental-modules feature. You can also use transpiler like Babel or Traceur -
// Read this article: https://appdividend.com/2019/03/13/es6-modules-in-node-tutorial-with-example/
// ES6 compat matrix - super useful link!!!: https://kangax.github.io/compat-table/es6/
import { sqrt, square } from './app';
const a = sqrt(4);
const b = square(2);
console.log(a);
console.log(b);
// import { projectId, projectName } from './module1';
// console.log(`${projectName} has id: ${projectId}`); // ReferenceError: projectId is not defined
import { projectId as id, projectName as pjName } from './module1'; // SntaxError: Identifier 'projectName' has already been declared
console.log(`${pjName} has id: ${id}`);
// import projectName from './module1-default';
import { default as myProjectDefaultName } from './module1-default';
console.log(`Project default name: ${myProjectDefaultName}`);
import * as values from './module1-default';
console.log(values);
import './module5';
import './module6';
import './module6-promise';
import './module7';
import './module8';
import './module9';
console.log('ending in server.mjs...');