-
Notifications
You must be signed in to change notification settings - Fork 256
/
routes.js
46 lines (43 loc) · 2.02 KB
/
routes.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
import generateFramework from './generators/framework/generateFramework';
import generateElectron from './generators/electron/generateElectron';
import generateJsLibrary from './generators/js-library/generateJsLibrary';
import generateStaticSite from './generators/static-site/generateStaticSite';
import generateTemplateEngine from './generators/template-engine/generateTemplateEngine';
import generateCssFramework from './generators/css-framework/generateCssFramework';
import generateBuildTool from './generators/build-tool/generateBuildTool';
import generateTesting from './generators/testing/generateTesting';
import generateJsFramework from './generators/js-framework/generateJsFramework';
import generateDatabase from './generators/database/generateDatabase';
import generateAuthentication from './generators/authentication/generateAuthentication';
import generateDeployment from './generators/deployment/generateDeployment';
import postprocessing from './generators/postprocessing';
import { walkAndRemoveCommentsMemory, createZipArchive } from './generators/utils';
export async function download(req, res) {
const params = req.body;
try {
if (params.platform === 'library') {
await generateJsLibrary(params);
} else if (params.platform === 'html5') {
await generateStaticSite(params);
} else if (params.platform === 'electron') {
await generateElectron(params);
} else {
await generateFramework(params);
await generateTemplateEngine(params);
await generateCssFramework(params);
await generateJsFramework(params);
await generateBuildTool(params);
await generateTesting(params);
await generateDatabase(params);
await generateAuthentication(params);
await generateDeployment(params);
await postprocessing(params);
}
await walkAndRemoveCommentsMemory(params);
await createZipArchive(res, params);
} catch (err) {
console.info(err.stack);
console.info(params);
res.status(500).send({ message: err.message, stack: err.stack });
}
}