diff --git a/.gitignore b/.gitignore index 7b1c6ee..3a0f46c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ **/dist **/config -!.prettierrc.json \ No newline at end of file +!.prettierrc.json diff --git a/README.md b/README.md index 0fd6b13..d5b1a63 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,31 @@ Version Live : https://html5.yayeet.cf +![Bannière](./banner.png) + +Necessite un fichier config (./api/config/config.json) comme celui-ci + +```json +{ + "server": { + "port": 8000, + "origin": ["http://localhost:8080"] + }, + "mongo": { + "uri": "mongodb://localhost:27017", + "dbName": "rate" + } +} +``` + +Ainsi qu'un SGBD MongoDB + ## Installation des dépendances Dans ./ ```bash -python ./scripts/install.py +python ./scripts/tools.py install ``` ## Pour lancer le projet diff --git a/api/package.json b/api/package.json index 6debfcb..26835db 100644 --- a/api/package.json +++ b/api/package.json @@ -7,8 +7,8 @@ "scripts": { "build": "tsc", "dev": "CONFIGFILE=config/config.json NODE_ENV=dev ts-node-dev --respawn --transpile-only ./src/app.ts", - "start": "npm run build && CONFIGFILE=config/config.json node ./dist/api/src/app.js", - "prettier": "prettier -w ./src" + "start": "CONFIGFILE=config/config.json NODE_ENV=dev node ./dist/api/src/app.js", + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@types/cors": "^2.8.12", diff --git a/api/src/framework/express/middleware.ts b/api/src/framework/express/middleware.ts index 6069954..86b24f6 100644 --- a/api/src/framework/express/middleware.ts +++ b/api/src/framework/express/middleware.ts @@ -22,7 +22,6 @@ export function RequestId(): RequestHandler { export function CheckPermissions(): RequestHandler { function getResourceId(req: Request): string | null { - console.log(req.url); if (req.params.uuid) return req.params.uuid; if (req.body.uuid) return req.body.uuid; return null; @@ -45,7 +44,6 @@ export function CheckPermissions(): RequestHandler { } const ressourceId = getResourceId(req); - console.log(ressourceId); if (!ressourceId) { next({ status: 403, messsage: 'Forbidden' }); return; diff --git a/api/src/framework/express/server.ts b/api/src/framework/express/server.ts index 1ead917..5150448 100644 --- a/api/src/framework/express/server.ts +++ b/api/src/framework/express/server.ts @@ -41,6 +41,7 @@ class Server { store: MongoStore.create({ mongoUrl: mongoConfig.uri, dbName: mongoConfig.dbName, + collectionName: 'sessions', touchAfter: 3600, }), resave: false, diff --git a/banner.png b/banner.png new file mode 100644 index 0000000..3e236f4 Binary files /dev/null and b/banner.png differ diff --git a/core/package.json b/core/package.json index 25d9ddb..a341c53 100644 --- a/core/package.json +++ b/core/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "build": "tsc", - "prettier": "prettier -w ./src" + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@types/node": "^18.8.4", diff --git a/scripts/tools.py b/scripts/tools.py index 25f9e74..0915d93 100755 --- a/scripts/tools.py +++ b/scripts/tools.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os import sys -import json apps = ['core', 'api', 'www'] commands = { @@ -12,7 +11,7 @@ commands = { def print_commands(): - print('Commandes disponibles: ', [c for c in commands]) + print('Available commands:', [c for c in commands]) if __name__ == '__main__': @@ -22,10 +21,11 @@ if __name__ == '__main__': cmd = sys.argv[1] if cmd not in commands: - print('Commande \'%s\' non disponible' % cmd) + print('Command \'%s\' not available' % cmd) print_commands() exit() + print('Running \'%s\' on %d apps: %s' % (commands[cmd], len(apps), apps)) for app in apps: os.chdir(app) os.system(commands[cmd]) diff --git a/www/package.json b/www/package.json index 7a4a58e..f6b40ad 100644 --- a/www/package.json +++ b/www/package.json @@ -6,10 +6,10 @@ "private": true, "scripts": { "build": "rollup -c", - "dev": "rollup -c -w ", + "dev": "rollup -c -w", "start": "sirv public --no-clear --host --single", "check": "svelte-check --tsconfig ./tsconfig.json", - "prettier": "prettier -w ./src" + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0",