Skip to content

GwankyuLee/restaurant_web_dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Restaurant Web App

A full-stack restaurant ordering web application with user authentication, authorization, and order management.

Architecture & Features

Technology Stack

  • Backend: Node.js + Express.js
  • Database: MongoDB + Mongoose
  • Frontend: Pug (templating engine) + JavaScript (client-side)
  • Authentication: Session-based with bcrypt password hashing
  • Session Management: express-session (stored in DB)

User Authentication & Authorization

  • User registration with password hashing
  • Secure login with session management
  • Authorization checks on protected routes (/order, /users/:id/privacy)
  • 401 Unauthorized responses for unauthenticated requests

User Management

  • Public user directory with search functionality
  • User profiles with order history
  • Privacy toggle to make profiles private/public
  • Profile privacy enforcement

Restaurant & Menu Management

  • RESTful API endpoints for restaurants
  • /api/restaurants - List all restaurants (without menu data)
  • /api/restaurants/:id - Get full restaurant details with menu
  • Dynamic menu loading from server
  • Support for menu categories and items

Order Management

  • Dynamic order interface that loads restaurants from server
  • Add/remove items from order
  • Real-time order total calculation (subtotal, tax, delivery fee)
  • Order submission with validation
  • Order history tracking per user
  • Order detail page with privacy controls

Session Management

  • Express-session for user sessions
  • Session persistence across requests
  • Automatic logout functionality
  • Session user accessible in all templates via res.locals

Setup Instructions

Prerequisites

  • Node.js installed
  • MongoDB running locally (default: mongodb://127.0.0.1:27017/restaurantDB)

Installation

  1. Install dependencies:
npm install
  1. Start MongoDB (if not already running):
mongod
  1. Seed the database with initial data:
node database-initializer.js

This will:

  • Clear the existing database
  • Create 10 test users (passwords = usernames)
  • Create 3 restaurants with menu items
  1. Start the server:
npm start

or directly:

node server.js

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors