aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json18
-rw-r--r--.vscode/settings.json10
-rw-r--r--package.json1
-rw-r--r--src/index.ts5
-rw-r--r--tsconfig.json10
5 files changed, 36 insertions, 8 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..3220b3d
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,18 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Launch Program",
+ "program": "${workspaceFolder}/src/index.ts",
+ "preLaunchTask": "npm: build",
+ "outFiles": [
+ "${workspaceFolder}/dist/**/*.js"
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..a3606ef
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,10 @@
+{
+ "files.exclude": {
+ "**/*.js": {
+ "when": "$(basename).ts"
+ },
+ "**/**.js": {
+ "when": "$(basename).tsx"
+ }
+ }
+} \ No newline at end of file
diff --git a/package.json b/package.json
index d67b85d..52f906e 100644
--- a/package.json
+++ b/package.json
@@ -41,5 +41,6 @@
"main": "dist/index.js",
"author": "Matt Strapp <matt@mattstrapp.net>",
"license": "MIT",
+ "type": "module",
"private": true
} \ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index e396151..8ef9a64 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -2,7 +2,6 @@ import express, { Request, Response } from 'express';
import session from 'express-session';
import rateLimit from 'express-rate-limit';
import slowDown from 'express-slow-down';
-import path from 'path';
import { env } from 'process';
import helmet from 'helmet';
import csurf from 'csurf';
@@ -46,8 +45,8 @@ app.use(helmet());
// Add ejs as view engine
app.set('view engine', 'ejs');
-app.set('views', path.join(__dirname, 'views/pages'));
-app.use('/public', express.static(path.join(__dirname, 'public')));
+app.set('views', 'views/pages');
+app.use('/public', express.static('public'));
app.get('/', csrf, (req: Request, res: Response) => {
res.render('index', {
diff --git a/tsconfig.json b/tsconfig.json
index 78a0979..9c05f4c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -21,9 +21,9 @@
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
/* Modules */
- "module": "commonjs", /* Specify what module code is generated. */
+ "module": "es6", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
@@ -37,10 +37,10 @@
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
/* Emit */
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"removeComments": true, /* Disable emitting comments. */