Express server for Finanseer, built following a code along
See frontend
Mongoose changed their API, took a minute to figure out issues.
Database: NoSQL Mongoose (simplified)
Money is handled using mongoose-currency which requires an older mongoose version, requiring the --legacy-peer-deps flag.
I tried various cors and helmet configurations due to a typo, but eventually figured it out.
Key Performance Indicators
- totalProfit: currency
- totalRevenue: currency
- totalExpenses: currency
- expensesByCategory: Map<string: currency>
- dailyData: Array
- monthlyData: Array
Transaction
- id: mongoDb id
- buyer: string
- amount: currency
- productIds: Array (for key)
Product
- id: mongoDb id
- price: currency
- expense: currency
- transactions: Array (for key)
In terminal:
git clone https://github.com/laurieroy/express-finance-dashboard
cd into directory, install dependencies
npm i --legacy-peer-deps
Create Mongo db and add MONGO_DB_SRV_URL and PORT (1337) to .env file
uncomment lines 45-53 in index.js and run once to seed data
Run server using nodemon:
npm run dev