Node Version for building the app: 22
Node Version for deploying to Firebase and for the cloud functions: 22
$ npm install
$ npm start [--project={PROJECT_NAME}]
Then open http://0.0.0.0:8080/webpack-dev-server/ in your browser.
project(optional): Name of the project. There must a configuration file called{PROJECT_NAME}.jsonbe available in theprojectsdirectory. The default project islszt.
$ npm test
$ npm install
project(optional): Name of the project. There must a configuration file called{PROJECT_NAME}.jsonbe available in theprojectsdirectory. The default project islszt.
$ npm run build [--project={PROJECT_NAME}]
$ npm run build:prod [--project={PROJECT_NAME}]
Node version for this step: 22
Prerequisites: Firebase Tools must be installed (npm install -g firebase-tools@13).
Caution: Ensure that you have selected the right Firebase project (list all projects by typing firebase list and change it if necessary (with firebase use)).
Code:
In project conf JSON file, set the following properties:
environments.(test|production).firebaseDatabaseNameenvironments.(test|production).firebaseDatabaseUrl
Functions:
Set the realtime database name for the cloud functions:
firebase functions:config:set rtdb.instance={RTDB NAME}
(e.g. firebase functions:config:set rtdb.instance=lszt-test)
If the database is not in the default location and the database URL is not {instance}.firebaseio.com, you also have
to set the database URL additionally:
firebase functions:config:set rtdb.url={RTDB URL}
(e.g. firebase functions:config:set rtdb.url=https://lszt-test-eu.europe-west1.firebasedatabase.app)
In the https://github.com/odch/flightbox-stripe repository, set the following Github-Workflow environment variables:
FIREBASE_RTDB_NAMEFIREBASE_RTDB_URL
Before executing this command, make sure the correct project was built using the Node version mentioned at the beginning of this document.
$ firebase target:apply database main {RTDB NAME}
$ firebase deploy --only hosting,database:main
(e.g. lszt-test for {RTDB NAME})
Use the following commands to deploy the cloud functions.
Before executing these commands, make sure you selected the correct Node version for the cloud functions, which is mentioned at the beginning of this document.
$ cd functions && npm ci && cd ..
$ firebase deploy --only functions
Can be called to create a custom authentication token. Has to be called via POST.
The following authentication modes are implemented: static, guest_token and kiosk_token.
Returns a token if the given username and password match one of the configured static credentials. The credentials
are configured via the AUTH_STATIC_CREDENTIALS environment variable as a comma-separated list of username:password
pairs (e.g. AUTH_STATIC_CREDENTIALS="foo:bar,admin:12345"). If no credentials are configured, authentication always
fails.
Request example:
$ curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"mode": "static", "username": "<USERNAME>", "password": "<PASSWORD>"}' \
https://europe-west1-<PROJECT_ID>.cloudfunctions.net/auth
URL: https://europe-west1-<PROJECT_ID>.cloudfunctions.net/api
Returns the current aerodrome status.
GET /api/aerodrome/status
Returns (example):
{
status: "closed",
last_update_by: "Hans Meier",
last_update_date: "2020-04-12T22:29:01.565Z",
message: "Flugplatz geschlossen. Kinderspielplatz und Restaurant geschlossen."
}
If no status is set, {} is returned.
POST an array of users to this endpoint to sync the users list.
New users are added, existing ones are updated, and those which are saved in the database, but not present in the given users array are removed from the database.
Example payload:
POST /api/users/import
{
"users": [
{
"memberNr": "48434",
"firstname": "John",
"lastname": "Doe",
"phone": "+41791234567",
"email": "john.doe@example.com"
},
{
"memberNr": "30443",
"firstname": "Jane",
"lastname": "Smith",
"phone": "+41791234568",
"email": "jane.smith@example.com"
},
...
]
}
This endpoint requires a Basic Auth header (username and password to use set in the function config:
api.serviceuser.username and api.serviceuser.password).