Tiny url provider for swooby.com
Examples:
More defined at:
For v1 I tried to get Firebase Functions Python code to work, but I ran into and got slowed down by issues.
- firebase/firebase-tools#8336 prevents using Python > 3.12.
WORKAROUND: Install Python 3.12 and:sudo ln -s /opt/homebrew/bin/python3.12 /usr/local/bin/python3.12
- Python Flask was not a drop in replacement for JavaScript Express;
I could not get it to work identical to JavaScript Express.
So, for v1 I am using raw JavaScript.
For v2 I may refactor to either TypeScript or Python.
- Install Firebase CLI:
https://firebase.google.com/docs/cli#install_the_firebase_clinpm install -g firebase-tools firebase login
- Init Firebase Project
swoo-by
firebase init
functions hosting emulator
JavaScript (one day TypeScript or Python again)
public directory: "hosting"
...
pushd functions
npm init
popd
pushd functions
python3.12 -m venv venv
source venv/bin/activate
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -r requirements.txt
deactivate
popd
Ordinarily, this should work:
npm install -g npm-check-updates
ncu
ncu -u
npm update --save
But, weird situation npm thinks latest express
is 4.21.2
,
even though 5.0.1
is released:
- https://github.com/expressjs/express/releases/tag/5.0.1
- https://expressjs.com/en/5x/api.html
- https://expressjs.com/en/guide/migrating-5.html
- https://www.npmjs.com/package/express SHOWS
4.21.2
!!! - https://github.com/expressjs/express/releases
Yes,4.21.2
is newer than5.0.1
, but the latest should be5.0.1
!
% cat package.json | grep express
"express": "^4.21.2",
% npm outdated
% ncu
Checking /Users/pv/Dev/GitHub/swooby/swoo.by/functions/package.json
[====================] 6/6 100%
All dependencies match the latest package versions :)
% npm install "express@^5.0.1"
...
% cat package.json | grep express
"express": "^5.0.1",
% npm outdated
Package Current Wanted Latest Location Depended by
express 5.0.1 5.0.1 4.21.2 node_modules/express functions
At least ncu -u
does not downgrade express from 5.0.1
to 4.21.2
!
TBD...
firebase emulators:start
pushd functions
Edit package.json
to add dependencies
npm i xyz
popd
pushd functions
Edit requirements.txt
to add dependencies
source venv/bin/activate
python3.12 -m pip install --upgrade pip
python3.12 -m pip install -r requirements.txt
deactivate
popd
Try some of the urls defined in ./functions/redirects.js
- http://swoo.by/meet
- http://swoo.by/resume
- http://swoo.by/pv/cv
- http://swoo.by/pv/resume
- http://swoo.by/r
- http://swoo.by/r/code
- http://swoo.by/r/data
- http://swoo.by/r/json
hosting
is deployed automatically by GitHub Actionsfunctions
that are"pinTag": true
are deployed automatically byhosting
.
GitHub Action Deploying pinTag
s will fail on default firebase init
projects.
For more info see:
firebase deploy --only functions,hosting