|
Robin Métral
9be9ab61fa
Add support for protected Polarsteps trips
These are obfuscated behind a ?s secret which we now forward to the API. We should expan the router to support query parameters. |
||
|---|---|---|
| src | Add support for protected Polarsteps trips | |
| .gitignore | Initial commit | |
| jsconfig.json | Initial commit | |
| LICENSE | Initial commit | |
| package-lock.json | Initial commit | |
| package.json | Initial commit | |
| README.md | Document rsync command on README | |
Functions
This is a simple Node.js server that exposes a series of utility functions (think serverless functions but with a server). It replaces the need to deploy functions to big tech infrastructure such as AWS Lambda, Cloudflare Workers or Vercel Functions.
Environment
The server runs on Node.js v24. Newer versions should work but are untested. Anything below v23.8 will not work, because the router uses the URLPattern API.
Deployment
Copy the contents of the src directory to a web server, for example via SSH:
rsync -r --delete src/ user@ssh.example.com:<path>/functions
# `-r`: recursive
# `--delete`: delete files in dest that aren't in src
# `src/` (with trailing slash): copy dir contents, omit dir itself
There are no runtime dependencies. To start the server, simply run:
node index.js # in the /functions directory
The server expects two environment variables to be set:
IP: the IP to listed on, defaults tolocalhostPORT: the port to listen on, defaults to3000
Development
This project uses JSDoc for type checking, using your IDE's1 TypeScript server. To install the Node.js types package, run:
npm install
To start the local server, run:
npm start
By default, the server will listen on localhost:3000.