Web framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

example.js 630B

1234567891011121314151617
  1. // Replace with require("webframe")
  2. var webframe = require("./index.js");
  3. var mw = webframe.middleware;
  4. var app = new webframe.App();
  5. // Endpoint which uses the "params" middleware to parse URL parameters
  6. app.get("/endpoint", [ mw.params ], (req, res) => {
  7. res.end("Hello, "+req.params.name);
  8. });
  9. // When a an endpoint path starts with a ^, it's interpreted as a
  10. // regular expression pattern. "^.*" matches everything (though endpoints
  11. // with explicit paths, like the "/endpoint" above, are prioritized).
  12. //
  13. // webframe.staic("web") returns a function which serves the file in "web".
  14. app.get("^.*", webframe.static("web"));