-
Notifications
You must be signed in to change notification settings - Fork 8
/
example.html
31 lines (29 loc) · 1.03 KB
/
example.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>Network diagram as code</title>
<script src="https://unpkg.com/@antirek/[email protected]/dist/code-full.min.js"></script>
</head>
<body style="font:14px helvetica neue, helvetica, arial, sans-serif;">
<h3>Example</h3>
<div id="scheme" style="height:300px;width:800px;"></div>
<script>
const elements = {
nodes: [
{ id: 'client', type: 'smartphone', label: 'Mobile App'},
{ id: 'server', type: 'server', label: 'Main Server'},
{ id: 'db1', type: 'database', group: 'db cluster', label: 'DB 1'},
{ id: 'db2', type: 'database', group: 'db cluster', label: 'DB 2'},
],
edges: [
{ source: 'client', target: 'server', label: 'request' },
{ source: 'server', target: 'db1', label: 'request' },
{ source: 'server', target: 'db2', label: 'request' },
],
};
Diagram('scheme', elements);
</script>
</body>
</html>