sauv avant switch branch

This commit is contained in:
pedro 2025-08-29 10:35:47 +02:00
parent 3714adfb83
commit bc3d4f6021
7 changed files with 81 additions and 0 deletions

1
app.js
View file

@ -64,3 +64,4 @@ app.use('/', routes);
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log('Serveur lancé sur http://localhost:' + PORT)); app.listen(PORT, () => console.log('Serveur lancé sur http://localhost:' + PORT));

24
controllers/search.js Normal file
View file

@ -0,0 +1,24 @@
const sqlite3 = require('sqlite3').verbose();
const dbPath = '../database.sqlite';
const db = new sqlite3.Database(dbPath, (err) => {
if (err) {
console.error(err.message);
}
console.log('Connected to the SQLite database.');
});
import L from 'leaflet';
const key = 'YOUR_MAPTILER_API_KEY_HERE';
document.addEventListener('DOMContentLoaded', function() {
const map = L.map('search-map').setView([49.2125578, 16.62662018], 14);
L.tileLayer(`https://api.maptiler.com/maps/streets-v2/{z}/{x}/{y}.png?key=${key}`, {
tileSize: 512,
zoomOffset: -1,
minZoom: 1,
attribution: "\u003ca href=\"https://www.maptiler.com/copyright/\" target=\"_blank\"\u003e\u0026copy; MapTiler\u003c/a\u003e \u003ca href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\"\u003e\u0026copy; OpenStreetMap contributors\u003c/a\u003e",
crossOrigin: true
}).addTo(map);
});
alert("connard");

7
package-lock.json generated
View file

@ -13,6 +13,7 @@
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "^5.1.0", "express": "^5.1.0",
"express-session": "^1.18.2", "express-session": "^1.18.2",
"leaflet": "^1.9.4",
"passport": "^0.7.0", "passport": "^0.7.0",
"passport-discord": "^0.1.4", "passport-discord": "^0.1.4",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"
@ -1182,6 +1183,12 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/leaflet": {
"version": "1.9.4",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
"license": "BSD-2-Clause"
},
"node_modules/lru-cache": { "node_modules/lru-cache": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",

View file

@ -19,6 +19,7 @@
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "^5.1.0", "express": "^5.1.0",
"express-session": "^1.18.2", "express-session": "^1.18.2",
"leaflet": "^1.9.4",
"passport": "^0.7.0", "passport": "^0.7.0",
"passport-discord": "^0.1.4", "passport-discord": "^0.1.4",
"sqlite3": "^5.1.7" "sqlite3": "^5.1.7"

View file

@ -7,6 +7,11 @@ router.get('/', (req, res) => {
res.render('index', { user: req.user }); res.render('index', { user: req.user });
}); });
// Page de recherche
router.get('/recherche', (req, res) => {
res.render('search', { user: req.user });
});
// Auth Discord // Auth Discord
router.get('/auth/discord', passport.authenticate('discord')); router.get('/auth/discord', passport.authenticate('discord'));

BIN
static/carte.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 KiB

43
views/search.ejs Normal file
View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title>Rechercher un restaurant</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="../controllers/search.js"></script>
</head>
<body>
<div id="menu-bar">Barre menu</div>
<!-- Liste des restaurants -->
<table id="search-rst-list">
<!-- element resto -->
<td>
<tr>element</tr>
<tr>element</tr>
<tr>element</tr>
<tr>element</tr>
<tr>element</tr>
<tr>element</tr>
</td>
<!-- ... -->
</table>
</div>
<!-- Barre de filtres -->
<div id="search-filter-bar">
<div>Nom ville</div>
<div>Filtrer par</div>
<div>Champ de recherche</div>
<div>Affiner recherche</div>
</div>
<!-- Carte interactive -->
<div id="search-map">
</div>
<div id="menu-footer">Barre footer</div>
</body>
</html>