Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5c48b30

Browse files
committed
Separate backend from algorithm-visualizer repo
0 parents commit 5c48b30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1263
-0
lines changed

‎.DS_Store

6 KB
Binary file not shown.

‎.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.idea
2+
/node_modules
3+
/npm-debug.log
4+
/public
5+
/pm2.config.js
6+
.DS_Store

‎.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/server.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/vcs.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/webResources.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/workspace.xml

Lines changed: 266 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/backend.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const {
2+
__DEV__,
3+
backendBuildPath,
4+
} = require('../environment');
5+
6+
if (__DEV__) {
7+
const webpack = require('webpack');
8+
const webpackConfig = require('../webpack.backend.config.js');
9+
const compiler = webpack(webpackConfig);
10+
11+
let backend = null;
12+
let lastHash = null;
13+
compiler.watch({
14+
watchOptions: {
15+
ignored: /public/,
16+
},
17+
}, (err, stats) => {
18+
if (err) {
19+
lastHash = null;
20+
compiler.purgeInputFileSystem();
21+
console.error(err);
22+
} else if (stats.hash !== lastHash) {
23+
lastHash = stats.hash;
24+
console.info(stats.toString({
25+
cached: false,
26+
colors: true,
27+
}));
28+
29+
delete require.cache[require.resolve(backendBuildPath)];
30+
backend = require(backendBuildPath).default;
31+
}
32+
});
33+
34+
const backendWrapper = (req, res, next) => backend(req, res, next);
35+
backendWrapper.getHierarchy = () => backend.hierarchy;
36+
module.exports = backendWrapper;
37+
} else {
38+
const backend = require(backendBuildPath).default;
39+
const backendWrapper = (req, res, next) => backend(req, res, next);
40+
backendWrapper.getHierarchy = () => backend.hierarchy;
41+
module.exports = backendWrapper;
42+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /