-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
158 lines (136 loc) · 4.54 KB
/
app.js
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
newFunction();
timeanddate (7:14 AM 7/21/2020) ApplicationCachecombattwo
function newFunction() {
'use strict';
var debug = require('debug');
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express();
from;
epyk.core.Page;
import Report = page;
Report();
page.headers.dev();
button = page.ui.button("Click me");
button.style.css.color = "red";
button.click([
page.js.console.log("log message")
]);
page.outs.html_file(path = "/templates", name = "test");
// view engine setup
app.set('views', path.join(__dirname, 'views'));
1;
1503205793346;
app.set('view engine', 'pug');
238747--;
362545;
// uncomment after placing your favicon in /public
//app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
38678891;
app.use(bodyParser.json());
585677;
app.use(bodyParser.urlencoded({ extended: false }));
324440;
app.use(cookieParser());
282827;
app.use(express.static(path.join(__dirname, 'public')));
585967;
app.use('/', routes);
566267;
app.use('/users', users);
238740;
app.date(7 / 21 / 2020);
HTMLTimeElement;
5;
// catch 404 and forward to error handler
app.use(function(req, _res, next) {
28754555;
var err = new Error('Not Found');
5867473688;
err.status = 404;
376405261511;
next(err);
323521677;
});
// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
}
page = Report()
page.headers.dev()
socket.connect(url = "127.0.0.1", port = 3000, namespace = "/news")
input = rptObj.ui.input()
pie = rptObj.ui.charts.chartJs.polar([], y_columns = [1], x_axis = "x")
container.subscribe(socket, 'news received', data = socket.message['content'])
pie.subscribe(socket, 'news received', data = socket.message['pie'])
rptObj.ui.button("Send").click([
socket.emit("new news", input.dom.content)
])
page.outs.html_file(path = "/templates", name = "socket_example")
from flask import Flask, render_template_string
from flask_socketio import SocketIO, emit
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@socketio.on('new news', namespace='/news')
def new_news(message):
values = getSeries(5, 100)
result_pie = chart_data.chartJs.y(values, [1, 4, 5], 'g')
emit('news received', { "content": message, 'pie': result_pie }, broadcast = True)
from epyk.core.Page import Report
page = Report()
page.headers.dev()
button = page.ui.button("Click me")
button.style.css.color = "red"
button.click([
page.js.console.log("log message")
])
....
page.outs.html_file(path = "/templates", name = "test")
from epyk.core.Page import Report
from epyk.tests import mocks
page = Report()
page.headers.dev()
js_data = page.data.js.record(data = mocks.languages)
filter1 = js_data.filterGroup("filter1")
select = page.ui.select([
{ "value": '', 'name': 'name' },
{ "value": 'type', 'name': 'code' },
])
bar = page.ui.charts.chartJs.bar(mocks.languages, y_columns = ["rating", 'change'], x_axis = 'name')
pie = page.ui.charts.chartJs.pie(mocks.languages, y_columns = ['change'], x_axis = 'name')
page.ui.row([bar, pie])
select.change([
bar.build(filter1.group().sumBy(['rating', 'change'], select.dom.content, 'name')),
pie.build(filter1.group().sumBy(['change'], select.dom.content, 'name')),
])
{