- Local auth: registration/login with email+password (bcrypt, MariaDB) - Landing page: marketing page at / with hero, categories, advantages, CTA - Tool categories: Images (4), Code (3), Web (3), Utilities (2) - Sidebar: category dividers, user avatar with logout - Protected routes: all tools require auth, landing/login/register public - New files: lib/db.js, routes/auth.js, login.html, register.html, landing.html - Dependencies: bcrypt, mysql2
23 lines
987 B
JavaScript
23 lines
987 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
|
|
const router = express.Router();
|
|
const pub = (...p) => path.join(__dirname, '..', 'public', ...p);
|
|
|
|
// Landing (public — served before auth middleware via express.static, but also as fallback route)
|
|
router.get('/', (req, res) => res.sendFile(pub('landing.html')));
|
|
|
|
// Dashboard (protected — after auth)
|
|
router.get('/dashboard', (req, res) => res.sendFile(pub('index.html')));
|
|
router.get('/home', (req, res) => res.redirect('/dashboard'));
|
|
|
|
// Tools
|
|
router.get('/md', (req, res) => res.sendFile(pub('md.html')));
|
|
router.get('/editor', (req, res) => res.sendFile(pub('editor.html')));
|
|
router.get('/sanitizer', (req, res) => res.sendFile(pub('sanitizer.html')));
|
|
router.get('/converter', (req, res) => res.sendFile(pub('converter.html')));
|
|
router.get('/formatter', (req, res) => res.sendFile(pub('formatter.html')));
|
|
router.get('/password', (req, res) => res.sendFile(pub('password.html')));
|
|
|
|
module.exports = router;
|