山维星球数据管理模块

nodejs开发的express路由模块,以restful接口形式提供gis数据处理、获取、存储、发布的一些能力

构建

构建前需要拥有 npmtsc等必要依赖。

build in windows

  • 按需编辑tsconfig.json
{
  "compilerOptions": {
    "sourceMap": false,
    "declaration": false,
    "removeComments": false,
    "target": "es6",
    "module": "commonjs",
    "outDir": "./build",
    "baseUrl": "./src",
    "alwaysStrict": true,
    "noImplicitAny": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "allowSyntheticDefaultImports": true,
    "typeRoots": [
      "./node_modules/@types"
    ],
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "moduleResolution": "node"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    ".idea",
    "node_modules",
    "build"
  ]
}
  • 安装npm依赖
npm install
  1. 创建编译结果文件夹
mkdir data_module
  1. typescript编译
tsc
  1. 复制编译结果
XCOPY .\build\**.* .\data_module\build\ /S /E 
COPY package.json data_module\package.json

import

"dependencies": {
    "data_module":  "file:./data_module"
}

typescript

import {TSConfig,TSRoute} from 'data_module';

const tsConfig: TSConfig = {
    database: "pg",
    pg: {
        user: "sunway",
        password: "sunwaywh",
        database: "tfs",
        host: "127.0.0.1",
        port: 5432
    },
    plugins: {
        mongod: "./plugins/Mongo3.6/bin/mongod.exe",
        upload: "./plugins/upload/upload.exe",
        update: "./plugins/update/update.exe"
    },
    mongo_storage_dir_path: "./mongo_data"
};
const tsRoute = new TSRoute(tsConfig);
app.use(`/tfs`, tsRoute.router)

javascript

const TSRoute = require('tileset_server').TSRoute

const tsConfig = {
    database: "pg",
    pg: {
        user: "sunway",
        password: "sunwaywh",
        database: "tfs",
        host: "127.0.0.1",
        port: 5432
    },
    plugins: {
        mongod: "./plugins/Mongo3.6/bin/mongod.exe",
        upload: "./plugins/upload/upload.exe",
        update: "./plugins/update/update.exe"
    },
    mongo_storage_dir_path: "./mongo_data"
};
const tsRoute = new TSRoute(tsConfig);
app.use(`/tfs`, tsRoute.router)

数据库模块

PlantUML rendering error: Failed to render inline diagram (Failed to generate PlantUML diagrams, PlantUML exited with code 127 (sh: 1: -tsvg: not found ).).

存储模块

PlantUML rendering error: Failed to render inline diagram (Failed to generate PlantUML diagrams, PlantUML exited with code 127 (sh: 1: -tsvg: not found ).).