math-exercises 1.3.14 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -34
- package/lib/server.js +2 -1
- package/package.json +6 -6
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,YAAY,2CAAiB,CAAC;AAOpC,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
3
|
+
exports.allExercises = void 0;
|
|
7
4
|
const exercises_1 = require("./exercises/exercises");
|
|
8
|
-
const express_1 = __importDefault(require("express"));
|
|
9
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
10
|
-
const cors_1 = __importDefault(require("cors"));
|
|
11
5
|
const allExercises = [...exercises_1.exercises];
|
|
12
6
|
exports.allExercises = allExercises;
|
|
13
|
-
// allExercises.forEach((exo) => {
|
|
14
|
-
// console.log(exo);
|
|
15
|
-
// console.log(exo.generator(10));
|
|
16
|
-
// });
|
|
17
|
-
const runServer = () => {
|
|
18
|
-
dotenv_1.default.config();
|
|
19
|
-
const app = (0, express_1.default)();
|
|
20
|
-
app.use((0, cors_1.default)());
|
|
21
|
-
app.get('/', (req, res) => {
|
|
22
|
-
res.json(allExercises);
|
|
23
|
-
});
|
|
24
|
-
app.get('/exo', (req, res) => {
|
|
25
|
-
const exoId = req.query.exoId;
|
|
26
|
-
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
27
|
-
if (!exo)
|
|
28
|
-
res.send('Exo not found');
|
|
29
|
-
const questions = exo === null || exo === void 0 ? void 0 : exo.generator(10);
|
|
30
|
-
res.json({
|
|
31
|
-
exercise: exo,
|
|
32
|
-
questions,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
app.listen('5000', () => {
|
|
36
|
-
console.log(`[server]: Server is running at http://localhost:5000`);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
exports.runServer = runServer;
|
package/lib/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "math-exercises",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.16",
|
|
4
4
|
"description": "Math exercises generator for middle school and high school",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"lib/**/*"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"dev": "nodemon",
|
|
10
|
+
"dev": "MODE=dev nodemon",
|
|
11
11
|
"start": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
13
|
"start:dev": "nodemon",
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
"@types/cors": "^2.8.13",
|
|
24
24
|
"@types/express": "^4.17.17",
|
|
25
25
|
"@types/node": "^18.11.9",
|
|
26
|
-
"cors": "^2.8.5",
|
|
27
|
-
"dotenv": "^16.0.3",
|
|
28
|
-
"express": "^4.18.2",
|
|
29
26
|
"nodemon": "^2.0.20",
|
|
30
27
|
"prettier": "^2.8.4",
|
|
31
28
|
"ts-node": "^10.9.1",
|
|
@@ -34,7 +31,10 @@
|
|
|
34
31
|
"tsconfig-paths": "^4.1.2",
|
|
35
32
|
"tslint": "^6.1.3",
|
|
36
33
|
"tslint-config-prettier": "^1.18.0",
|
|
37
|
-
"typescript": "^4.9.3"
|
|
34
|
+
"typescript": "^4.9.3",
|
|
35
|
+
"cors": "^2.8.5",
|
|
36
|
+
"dotenv": "^16.0.3",
|
|
37
|
+
"express": "^4.18.2"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|