Converted examples to Typescript

This commit is contained in:
Alexander Cerutti
2019-06-12 23:36:38 +02:00
parent 10ef5f30b6
commit 8ff9ed51c8
6 changed files with 29 additions and 27 deletions

26
examples/webserver.ts Normal file
View File

@@ -0,0 +1,26 @@
/*
* Generic webserver instance for the examples
* @Author Alexander P. Cerutti
* Requires express to run
*/
import express from "express";
const app = express();
app.use(express.json());
app.listen(8080, "0.0.0.0", function(request, response) {
console.log("Webserver started.");
});
app.all("/", function (request, response) {
response.redirect("/gen/");
});
app.route("/gen")
.all((req, res) => {
res.set("Content-Type", "text/html");
res.send("Cannot generate a pass. Specify a modelName in the url to continue. <br/>Usage: /gen/<i>modelName</i>")
});
export default app.route("/gen/:modelName");