"use strict";

const express = require("express");
const https = require("https");
const path = require("path");
const fs = require("fs");

const app = express();

const PORT = 3000;
const SDK_dir = path.join(__dirname, "..");

app.use(express.static(SDK_dir));

app.get("/", (req, res) => {
    res.sendFile(SDK_dir + "/Samples/index.html");
});

https
    .createServer(
        {
            key: fs.readFileSync(__dirname + "/server.key"),
            cert: fs.readFileSync(__dirname + "/server.cert"),
        },
        app,
    )
    .listen(PORT, () => {
        console.log(
            `Example app listening on port ${PORT}! Go to https://localhost:${PORT}`,
        );
    });
