Skip to content

Instantly share code, notes, and snippets.

@jfhbrook
Created March 23, 2022 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfhbrook/2e59a7ca9d24b77d02c553061e3acac1 to your computer and use it in GitHub Desktop.
Save jfhbrook/2e59a7ca9d24b77d02c553061e3acac1 to your computer and use it in GitHub Desktop.
Sketch of an API for a javascript proxy layer
module.exports = ({ forward, listen, match, proxy, whenever }) => {
// dokuwiki
listen(80, () => {
whenever(match('/'),
forward('localhost', 8080)
);
});
// pulp
listen(24816, () => {
forward('localhost', 24816);
});
// api for handling side effects, "embedded apps" etc
/*
* handle('pull some shenanigans', (req, res) => {
* // a side effect, basically
* });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment