Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chat_app

Chat Application — Sprint 2

A minimal chat app with an Express backend and a plain HTML/JS frontend.

Project structure

chat_app/
├── backend/
│   ├── server.js       # Express REST API (GET/POST messages, in-memory store)
│   ├── websocket.js     # Standalone WebSocket server (broadcasts messages to clients)
│   └── package.json
├── front/
│   ├── script.js        # Polls the REST API and renders/sends messages
│   ├── web.js            # WebSocket client (connects to ws://<host>)
│   └── style.css
├── index.html            # Entry page, loads front/script.js
└── Dockerfile             # Builds and runs the backend (server.js)

Backend

The REST API (backend/server.js) exposes:

  • GET /get/messages — returns all stored messages
  • POST /post/messages — appends a { user, message } payload to the in-memory store

Messages are not persisted — they reset whenever the server restarts.

Run locally

cd backend
npm install
npm start

The server listens on http://localhost:3000.

There is also a separate WebSocket server (backend/websocket.js) that broadcasts incoming messages to all connected clients on port 3000. It is not started together with server.js — run it directly with node backend/websocket.js if you want the WebSocket-based flow (paired with front/web.js) instead of the REST polling flow.

Frontend

Open index.html in a browser (or serve it with any static file server). It loads front/script.js, which fetches and posts messages against the API URL configured at the top of that file. Update that URL to point at your own backend deployment.

Docker

Build and run just the backend:

docker build -t chat-app-backend .
docker run -p 3000:3000 chat-app-backend

About

Chat Application Sprint 2

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages