scitor 1 year ago
commit
0cc07ad430
3 changed files with 23 additions and 0 deletions
  1. 3
    0
      README.md
  2. 9
    0
      index.js
  3. 11
    0
      package.json

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
1
+# webserver
2
+
3
+simple webserver exposing /public (built from screeps slack snippet)

+ 9
- 0
index.js View File

@@ -0,0 +1,9 @@
1
+const express = require('express');
2
+
3
+module.exports = function (config) {
4
+ if(!config.backend) return; // Don't do anything if not the backend/api module
5
+
6
+ config.backend.on('expressPreConfig', function(app){
7
+	app.use('/', express.static('./public'));
8
+ });
9
+}

+ 11
- 0
package.json View File

@@ -0,0 +1,11 @@
1
+{
2
+  "name": "webserver",
3
+  "version": "1.0.0",
4
+  "description": "simple server exposing /public",
5
+  "main": "index.js",
6
+  "scripts": {
7
+    "test": "echo \"Error: no test specified\" && exit 1"
8
+  },
9
+  "author": "screeps slack",
10
+  "license": "ISC"
11
+}