How personaldevworks/myloginbackend works
MyLoginApp is an Express API for login and registration, with user-management endpoints backed by SQL Server. The principal flow is HTTP requests through the Express app and routes to controllers, which validate credentials or user data, access the database, and return JSON; login also issues a JWT used to protect user listing. The shown source supports these links. The README describes the frontend/API relationship, but no frontend implementation is in this repository.
Main entry points: index.ts Express app · db.ts SQL connection · userRoutes.ts User routes · server.ts Server startup
Components 10
HTTP API
- Server startup
src/server.ts - Express app
src/index.ts - Auth routes
src/routes/authRoutes.ts - User routes
src/routes/userRoutes.ts
Identity and Users
- Login handler
src/controllers/authController.ts - User handlers
src/controllers/userController.ts - Token verification
src/middleware/authMiddleware.ts
Persistence
- SQL connection
src/db.ts - SQL Server
Other components
- API client
Connections 11
- Server startup → Express app: starts
src/server.ts - Server startup → SQL connection: checks connection
src/server.ts - API client → Express app: sends requests
README.md - Express app → Auth routes: mounts auth
src/index.ts - Express app → User routes: mounts users
src/index.ts - Auth routes → Login handler: dispatches login
src/routes/authRoutes.ts - User routes → User handlers: dispatches users
src/routes/userRoutes.ts - User routes → Token verification: protects listing
src/routes/userRoutes.ts - Login handler → SQL connection: queries users
src/controllers/authController.ts - User handlers → SQL connection: reads and writes
src/controllers/userController.ts - SQL connection → SQL Server: connects
src/db.ts