Skip to content

JoannaAtMarist/node-weather-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Violet Avenue Gardeners

Built: Fall 2024

A Node.js + Express web app with user accounts, sessions, profile preferences (ZIP), and weather lookup via the VisualCrossing API. Uses an MVC-style structure and MongoDB for persistence.

Tech Stack

  • Node.js, Express
  • MongoDB + Mongoose
  • EJS templates
  • bcryptjs (password hashing)
  • express-session (sessions)
  • node-fetch (API requests)

Features

  • User registration + login (bcryptjs password hashing)
  • Session-based authentication
  • Profile management (including ZIP code preference)
  • Weather data fetching by ZIP code (VisualCrossing)
  • Static assets served from the client public folder

Installation

Prerequisites

  • Node.js (LTS recommended)
  • MongoDB Community Server running locally

1) Install dependencies

From the project root:

npm install

2) Configure environment variables

Create a .env file in the project root (do not commit this file). Start by copying the example:

cp .env.example .env

Then fill in the values in .env.

3) Start MongoDB

How you start MongoDB depends on your OS:

macOS (Homebrew):

brew services start mongodb-community

Linux (systemd):

sudo systemctl start mongod

Windows: Start the “MongoDB Server” service, or run mongod if you installed it manually.

4) Run the server

node Server/index.js

Then open:

http://localhost:3000

Environment Variables

This project expects the following variables (see .env.example):

  • PORT -> Server port (default 3000)
  • MONGODB_URI -> MongoDB connection string
  • SESSION_SECRET -> Secret used to sign sessions
  • VISUALCROSSING_API_KEY -> VisualCrossing API key
  • DEFAULT_ZIP -> Optional default ZIP used by the app
  • NODE_ENV -> Runtime mode (development/production)

File Structure

Project Root
│── Server
│   ├── controllers
│   │   ├── mainController.js
│   │   ├── accountController.js
│   ├── models
│   │   ├── Account.js
│   │   ├── APIData.js
│   │   ├── Account.js
│   ├── index.js
│── Client
│   ├── views (EJS templates)
│   ├── public (CSS, JS, images)

Known Issues / Limitations

I’m aware of the following issues:

  • Login page CSS is not applying correctly.

  • Production security hardening is incomplete: This project is not production-hardened (limited input validation, no CSRF protection, no rate limiting, and session cookie settings are basic).

  • Asset licensing/attribution may be incomplete: Image assets were obtained from free-use sites, but licensing/attribution is not fully documented.

Usage / Permission

This repository is public for portfolio viewing.
Reuse, redistribution, or submission of this code for academic work is not permitted without explicit permission.

About

Node/Express + MongoDB web app featuring sessions, profile preferences, and external API data integration (Fall 2024).

Topics

Resources

Stars

Watchers

Forks

Contributors