misc
This commit is contained in:
parent
6b815a6a68
commit
78addafe18
21
README.md
21
README.md
@ -2,12 +2,31 @@
|
|||||||
|
|
||||||
Version Live : https://html5.yayeet.cf
|
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
|
## Installation des dépendances
|
||||||
|
|
||||||
Dans ./
|
Dans ./
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python ./scripts/install.py
|
python ./scripts/tools.py install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pour lancer le projet
|
## Pour lancer le projet
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "CONFIGFILE=config/config.json NODE_ENV=dev ts-node-dev --respawn --transpile-only ./src/app.ts",
|
"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",
|
"start": "CONFIGFILE=config/config.json NODE_ENV=dev node ./dist/api/src/app.js",
|
||||||
"prettier": "prettier -w ./src"
|
"prettier": "prettier -w --cache ./src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cors": "^2.8.12",
|
"@types/cors": "^2.8.12",
|
||||||
|
@ -22,7 +22,6 @@ export function RequestId(): RequestHandler {
|
|||||||
|
|
||||||
export function CheckPermissions(): RequestHandler {
|
export function CheckPermissions(): RequestHandler {
|
||||||
function getResourceId(req: Request): string | null {
|
function getResourceId(req: Request): string | null {
|
||||||
console.log(req.url);
|
|
||||||
if (req.params.uuid) return req.params.uuid;
|
if (req.params.uuid) return req.params.uuid;
|
||||||
if (req.body.uuid) return req.body.uuid;
|
if (req.body.uuid) return req.body.uuid;
|
||||||
return null;
|
return null;
|
||||||
@ -45,7 +44,6 @@ export function CheckPermissions(): RequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ressourceId = getResourceId(req);
|
const ressourceId = getResourceId(req);
|
||||||
console.log(ressourceId);
|
|
||||||
if (!ressourceId) {
|
if (!ressourceId) {
|
||||||
next({ status: 403, messsage: 'Forbidden' });
|
next({ status: 403, messsage: 'Forbidden' });
|
||||||
return;
|
return;
|
||||||
|
@ -41,6 +41,7 @@ class Server {
|
|||||||
store: MongoStore.create({
|
store: MongoStore.create({
|
||||||
mongoUrl: mongoConfig.uri,
|
mongoUrl: mongoConfig.uri,
|
||||||
dbName: mongoConfig.dbName,
|
dbName: mongoConfig.dbName,
|
||||||
|
collectionName: 'sessions',
|
||||||
touchAfter: 3600,
|
touchAfter: 3600,
|
||||||
}),
|
}),
|
||||||
resave: false,
|
resave: false,
|
||||||
|
BIN
banner.png
Normal file
BIN
banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -6,7 +6,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"prettier": "prettier -w ./src"
|
"prettier": "prettier -w --cache ./src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.8.4",
|
"@types/node": "^18.8.4",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
|
||||||
|
|
||||||
apps = ['core', 'api', 'www']
|
apps = ['core', 'api', 'www']
|
||||||
commands = {
|
commands = {
|
||||||
@ -12,7 +11,7 @@ commands = {
|
|||||||
|
|
||||||
|
|
||||||
def print_commands():
|
def print_commands():
|
||||||
print('Commandes disponibles: ', [c for c in commands])
|
print('Available commands:', [c for c in commands])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -22,10 +21,11 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
cmd = sys.argv[1]
|
cmd = sys.argv[1]
|
||||||
if cmd not in commands:
|
if cmd not in commands:
|
||||||
print('Commande \'%s\' non disponible' % cmd)
|
print('Command \'%s\' not available' % cmd)
|
||||||
print_commands()
|
print_commands()
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
print('Running \'%s\' on %d apps: %s' % (commands[cmd], len(apps), apps))
|
||||||
for app in apps:
|
for app in apps:
|
||||||
os.chdir(app)
|
os.chdir(app)
|
||||||
os.system(commands[cmd])
|
os.system(commands[cmd])
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
"dev": "rollup -c -w ",
|
"dev": "rollup -c -w",
|
||||||
"start": "sirv public --no-clear --host --single",
|
"start": "sirv public --no-clear --host --single",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||||
"prettier": "prettier -w ./src"
|
"prettier": "prettier -w --cache ./src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "^17.0.0",
|
"@rollup/plugin-commonjs": "^17.0.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user