Skip to content

Commit 020c617

Browse files
authored
Merge pull request #91 from RustyRory/feat/89-collection-championships
Feat/89 collection championships
2 parents 2b789cc + e90015a commit 020c617

43 files changed

Lines changed: 1859 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
### Supprimé
2525

2626
-
27+
---
28+
29+
## [0.2.0] - 2026-01-22
30+
31+
### Ajouté
2732

33+
- /Backend
34+
- server.js
35+
- /src
36+
- app.js
37+
- /controllers
38+
- /models
39+
- /routes
40+
2841
---
2942

3043
## [0.1.0] - 2026-01-21

app/assets/images/default_logo.png

Loading

app/backend/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PORT=3000

app/backend/.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

app/backend/.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"printWidth": 120,
6+
"tabWidth": 2,
7+
"endOfLine": "lf"
8+
}

app/backend/eslint.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
files: ['**/*.js'],
8+
languageOptions: {
9+
ecmaVersion: 'latest',
10+
sourceType: 'module',
11+
globals: {
12+
...globals.node,
13+
},
14+
},
15+
rules: {
16+
// règles backend utiles
17+
'no-unused-vars': ['warn'],
18+
'no-console': 'off',
19+
},
20+
},
21+
];

app/backend/package.json

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
{
22
"name": "backend",
3-
"version": "0.0.2",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"type": "module",
47
"scripts": {
5-
"lint": "echo 'No backend lint yet' && exit 0",
6-
"format": "echo 'No backend format yet' && exit 0",
7-
"test": "echo 'No backend tests yet' && exit 0"
8+
"start": "node server.js",
9+
"dev": "nodemon server.js",
10+
"lint": "eslint src/**/*.js",
11+
"lint:fix": "eslint src/**/*.js --fix",
12+
"format": "prettier --write \"src/**/*.js\"",
13+
"prepare-commit": "npm run format && npm run lint:fix",
14+
"test": "echo \"Error: no test specified\" && exit 0",
15+
"prepare": "husky install"
16+
},
17+
"dependencies": {
18+
"bcrypt": "^6.0.0",
19+
"cors": "^2.8.5",
20+
"dotenv": "^17.2.3",
21+
"express": "^5.2.1",
22+
"mongoose": "^9.1.5"
23+
},
24+
"devDependencies": {
25+
"@eslint/js": "^9.39.2",
26+
"eslint": "^9.39.2",
27+
"globals": "^17.0.0",
28+
"husky": "^9.1.7",
29+
"lint-staged": "^16.2.7",
30+
"nodemon": "^3.1.11",
31+
"prettier": "^3.8.1"
32+
},
33+
"lint-staged": {
34+
"src/**/*.js": [
35+
"prettier --write",
36+
"eslint --fix",
37+
"git add"
38+
]
839
}
940
}

app/backend/server.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import dotenv from 'dotenv';
2+
dotenv.config();
3+
4+
import mongoose from 'mongoose';
5+
import app from './src/app.js';
6+
7+
const PORT = process.env.PORT || 5000;
8+
const MONGO_URI = process.env.MONGO_URI || 'mongodb://127.0.0.1:27017/saintbarthvolley';
9+
10+
// Connexion à MongoDB
11+
mongoose.connect(MONGO_URI)
12+
.then(() => {
13+
console.log('MongoDB connected');
14+
15+
// Lancer le serveur
16+
app.listen(PORT, () => {
17+
console.log(`Server launched on http://localhost:${PORT}`);
18+
});
19+
})
20+
.catch(err => console.error('Error MongoDB:', err));

app/backend/src/app.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import express from 'express';
2+
import cors from 'cors';
3+
// Création de l'application Express
4+
const app = express();
5+
// Middlewares
6+
app.use(cors());
7+
// Pour parser le corps des requêtes en JSON
8+
app.use(express.json());
9+
10+
// Route par défaut pour tester l'API
11+
app.get('/', (req, res) => {
12+
res.send('API Volley fonctionne !');
13+
});
14+
15+
// Importer les routes
16+
import usersRoutes from './routes/users.js';
17+
import clubsRoutes from './routes/clubs.js';
18+
import seasonsRoutes from './routes/seasons.js';
19+
import teamsRoutes from './routes/teams.js';
20+
import membersRoutes from './routes/members.js';
21+
import newsRoutes from './routes/news.js';
22+
import albumsRoutes from './routes/albums.js';
23+
import mediasRoutes from './routes/medias.js';
24+
import partnersRoutes from './routes/partners.js';
25+
import championshipsRoutes from './routes/championships.js';
26+
27+
// Utiliser les routes
28+
app.use('/api/users', usersRoutes);
29+
app.use('/api/clubs', clubsRoutes);
30+
app.use('/api/seasons', seasonsRoutes);
31+
app.use('/api/teams', teamsRoutes);
32+
app.use('/api/members', membersRoutes);
33+
app.use('/api/news', newsRoutes);
34+
app.use('/api/albums', albumsRoutes);
35+
app.use('/api/medias', mediasRoutes);
36+
app.use('/api/partners', partnersRoutes);
37+
app.use('/api/championships', championshipsRoutes);
38+
39+
// Exporter l'application
40+
export default app;

0 commit comments

Comments
 (0)