Multi-user trip planning web app in a single Docker container. Mullvad-style token accounts, trip sharing via join codes, day-by-day calendar with typed entries (activity, hotel, travel, flight, rental car, immigration, note), multi-leg flight segments with bundled IATA airport dataset, Leaflet/OSM map with per-leg great-circle km (air vs ground), rough km-driven vs rental included-km comparison, cost splitting with settle-up suggestions, flip-clock departure countdown. Node 20 + Express + SQLite (WAL, additive migrations), vanilla JS SPA, 44 API tests.
9 lines
318 B
JavaScript
9 lines
318 B
JavaScript
// Session guard: rejects unauthenticated requests with 401 JSON.
|
|
// Identity is Mullvad-style (account tokens); token hashing lives in util/token.js.
|
|
export function requireAuth(req, res, next) {
|
|
if (!req.session || !req.session.userId) {
|
|
return res.status(401).json({ error: 'unauthorized' });
|
|
}
|
|
next();
|
|
}
|