instaserve 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs CHANGED
@@ -14,6 +14,7 @@ http
14
14
  data = JSON.parse(data);
15
15
  } catch { }
16
16
  });
17
+ s.endJSON = o => s.end(JSON.stringify(o))
17
18
  const midware = Object.keys(routes)
18
19
  .filter((k) => k.startsWith('_'))
19
20
  .map((k) => routes[k]({ r, s, data, db }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instaserve",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "bin": "./index.mjs"
package/routes.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  _debug: ({ r, s, db }) => console.log(db, r.method),
3
- '/': ({ s }) => s.end('hello index'),
3
+ '/': ({ s }) => s.endJSON({message: 'hello index'}),
4
4
  'tables': name => ([k, v]) => k.match(`${name}:`)
5
5
  }
package/vastdb.mjs CHANGED
@@ -31,6 +31,7 @@ export default class VastDB extends Map {
31
31
  if (!o.id) o.id = o.type + ':' + o.name;
32
32
  }
33
33
  arr.map((o) => super.set(o.id, o));
34
+ if(this.event) this.event(arr)
34
35
  this.save();
35
36
  }
36
37
  save() {