@rpcbase/server 0.26.0 → 0.30.0

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/database.js CHANGED
@@ -15,6 +15,7 @@ if (typeof DATABASE_NAME !== "string") {
15
15
  const mongo_url = `mongodb://database:${DATABASE_PORT}/${DATABASE_NAME}`
16
16
 
17
17
  module.exports = async() => {
18
+ console.log("ICIIIII", mongo_url)
18
19
  const ret = await mongoose.connect(mongo_url)
19
20
  // TODO: handle connection ret
20
21
  // console.log(ret)
package/express/index.js CHANGED
@@ -28,9 +28,20 @@ module.exports = () => {
28
28
 
29
29
  // CORS
30
30
  const cors_origins = is_production ?
31
- [`*.${APP_DOMAIN}`, APP_DOMAIN] :
32
- [`http://localhost:*`, "localhost"]
33
- // [`http://localhost:${CLIENT_PORT}`, "localhost"]
31
+ // https://stackoverflow.com/questions/14003332/access-control-allow-origin-wildcard-subdomains-ports-and-protocols
32
+ // production
33
+ [
34
+ `https://www.${APP_DOMAIN}`,
35
+ `https://${APP_DOMAIN}`,
36
+ `https://admin.${APP_DOMAIN}`,
37
+ APP_DOMAIN,
38
+ ] :
39
+ // local dev origins
40
+ [
41
+ `http://localhost:${CLIENT_PORT}`,
42
+ "http://localhost:8090",
43
+ "localhost",
44
+ ]
34
45
  console.log("SETUP CORS", cors_origins)
35
46
  app.use(cors({
36
47
  origin: cors_origins,
package/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
  const client_router = require("./client/client_router")
3
3
  const database = require("./database")
4
4
  const express = require("./express")
5
- const mongoose = require("./mongoose")
6
5
  const rpc_router = require("./rpc/rpc_router")
7
6
 
8
7
 
@@ -10,6 +9,5 @@ module.exports = {
10
9
  client_router,
11
10
  database,
12
11
  express,
13
- mongoose,
14
12
  rpc_router,
15
13
  }
package/mongoose/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  /* @flow */
2
2
  const mongoose = require("mongoose")
3
3
 
4
- const rts_delete_plugin = require("./rts_delete_plugin")
4
+ // browsers do not have mongoose plugins
5
+ if (typeof mongoose.plugin === "function") {
6
+ const rts_delete_plugin = require("./rts_delete_plugin")
5
7
 
6
- mongoose.plugin(rts_delete_plugin)
8
+ mongoose.plugin(rts_delete_plugin)
9
+ }
7
10
 
8
11
  module.exports = mongoose
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.26.0",
3
+ "version": "0.30.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {