Files
satshkd-vercel/index.js
Claude 447f740f59 Remove all HKD/satshkd support, keep only EUR version
- Removed all HKD routes (/en, /zh-cn, /zh-hk) from index.js
- Removed HKD locale files (en.json, zh-cn.json, zh-hk.json)
- Removed HKD calculation files (calculate.js, btcpoll.js, updaterate.js from old version)
- Removed HKD historical data files (hkd_historical, hkd_historical_dedup)
- Renamed EUR-specific files to standard names:
  - calculate-eur.js -> calculate.js
  - btcpoll-eur.js -> btcpoll.js
  - updaterate-eur.js -> updaterate.js
  - eur_historical -> historical
- Updated all locale files to reference 'historical' instead of 'eur_historical'
- Updated default route to redirect to /en-eur instead of /en
- Updated GitHub Actions workflow to only run EUR data updates
- Updated all references in code to use renamed files

This creates a clean EUR-only implementation ready for deployment at eursat.eu
2025-11-09 09:36:33 +00:00

112 lines
3.0 KiB
JavaScript

/**
* Module dependencies.
*/
const express = require("express");
const logger = require('morgan');
const path = require('path');
const app = express();
const handlebars = require('express-handlebars');
const port = 3000;
const calculate = require('./calculate')
const enjson = require('./locales/en-eur.json');
const dejson = require('./locales/de.json');
const frjson = require('./locales/fr.json');
const esjson = require('./locales/es.json');
const itjson = require('./locales/it.json');
const nljson = require('./locales/nl.json');
const ptjson = require('./locales/pt.json');
const pljson = require('./locales/pl.json');
app.set('view engine', 'hbs');
app.set('views', __dirname + '/views')
app.engine('hbs', handlebars({
layoutsDir: __dirname + '/views/layouts',
defaultLayout: 'main',
extname: 'hbs',
}));
app.use(express.static('public'))
// log requests
app.use(logger('dev'));
app.use(express.static(path.join(__dirname, 'public')));
app.use('/static', express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'public', 'css')));
app.get('/', function(req, res) {
res.redirect('/en-eur');
});
// EUR routes
app.get('/en-eur', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let endata = Object.assign(enjson, yeardata)
res.render('sats', endata)
})
});
app.get('/de', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let dedata = Object.assign(dejson, yeardata)
res.render('sats', dedata)
})
});
app.get('/fr', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let frdata = Object.assign(frjson, yeardata)
res.render('sats', frdata)
})
});
app.get('/es', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let esdata = Object.assign(esjson, yeardata)
res.render('sats', esdata)
})
});
app.get('/it', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let itdata = Object.assign(itjson, yeardata)
res.render('sats', itdata)
})
});
app.get('/nl', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let nldata = Object.assign(nljson, yeardata)
res.render('sats', nldata)
})
});
app.get('/pt', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let ptdata = Object.assign(ptjson, yeardata)
res.render('sats', ptdata)
})
});
app.get('/pl', function(req, res) {
calculate.get10yr().then(pydata => {
const yeardata = { 'yeardata': pydata }
let pldata = Object.assign(pljson, yeardata)
res.render('sats', pldata)
})
});
//Makes the app listen to port 3000
app.listen(port, () => console.log(`App listening to port ${port}`));