Delete old server and improve project configuration

Changes:
- Delete old server files from project root
    - /app.ts
    - /jamiDaemon.ts
    - /routes/
    - /rollup.config.js
    - /jamiServerConfig.json
    - /*.env
- Remake tsconfig.json for client, common, and server
    - Delete root /tsconfig.json
    - Make subproject tsconfig.json files standalone
    - Improve consistency between tsconfig.json files
- Move Cypress and Sentry tests to client/
- Update README.md, Dockerfile and .dockerignore
    - Remove extra symlink
    - Remove mentions and links to old server (e.g. ports)
- Remove boilerplate project in test/, which has nothing to do with tests
- Update package.json to remove scripts for old server
- Update .gitignores to be consistent with their folder contents

GitLab: #109
Change-Id: Ie575113288c973115c3236e030b02d1a54e3510c
diff --git a/client/sentry.js b/client/sentry.js
new file mode 100644
index 0000000..5dd25f6
--- /dev/null
+++ b/client/sentry.js
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2022 Savoir-faire Linux Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+import * as Sentry from '@sentry/node';
+import * as Tracing from '@sentry/tracing';
+// import config from "./sentry-server.config.json" assert { type: "json" };
+
+export function sentrySetUp(app) {
+  Sentry.init({
+    integrations: [
+      // enable HTTP calls tracing
+      new Sentry.Integrations.Http({ tracing: true }),
+      // enable Express.js middleware tracing
+      new Tracing.Integrations.Express({ app }),
+    ],
+  });
+
+  // RequestHandler creates a separate execution context using domains, so that every
+  // transaction/span/breadcrumb is attached to its own Hub instance
+  app.use(Sentry.Handlers.requestHandler());
+  // TracingHandler creates a trace for every incoming request
+  app.use(Sentry.Handlers.tracingHandler());
+
+  app.get('/debug-sentry', function mainHandler(_req, _res) {
+    throw new Error('My first Sentry error!');
+  });
+
+  // The error handler must be before any other error middleware and after all controllers
+  // app.use(Sentry.Handlers.errorHandler());
+  app.use(
+    Sentry.Handlers.errorHandler({
+      shouldHandleError(error) {
+        // Capture all 404 and 500 errors
+        if (error.status === 404 || error.status === 500) {
+          return true;
+        }
+        return false;
+      },
+    })
+  );
+  // Optional fallthrough error handler
+  app.use(function onError(_err, _req, res, _next) {
+    // The error id is attached to `res.sentry` to be returned
+    // and optionally displayed to the user for support.
+    res.statusCode = 500;
+    res.end(res.sentry + '\n');
+  });
+}