This commit is contained in:
Yanis Rigaudeau 2022-10-25 23:06:10 +02:00
parent 6b815a6a68
commit 78addafe18
Signed by: yanis
GPG Key ID: 4DD2841DF1C94D83
9 changed files with 30 additions and 12 deletions

View File

@ -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

View File

@ -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",

View File

@ -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;

View File

@ -41,6 +41,7 @@ class Server {
store: MongoStore.create({
mongoUrl: mongoConfig.uri,
dbName: mongoConfig.dbName,
collectionName: 'sessions',
touchAfter: 3600,
}),
resave: false,

BIN
banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -6,7 +6,7 @@
"private": true,
"scripts": {
"build": "tsc",
"prettier": "prettier -w ./src"
"prettier": "prettier -w --cache ./src"
},
"devDependencies": {
"@types/node": "^18.8.4",

View File

@ -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])

View File

@ -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",