import path from 'path' ; import express from 'express' ; import prostgles from "prostgles-server" ; process . on ( 'unhandledRejection' , ( reason , p ) => { console . trace ( 'Unhandled Rejection at:' , p , 'reason:' , reason ) ; process . exit ( 1 ) ; } ) ; const app = express ( ) ; app . use ( express . json ( ) ) ; app . use ( express . urlencoded ( { extended : true } ) ) ; const _http = require ( "http" ) ; const http = _http . createServer ( app ) ; const io = require ( "socket.io" ) ( http , { path : "/s" } ) ; http . listen ( process . env . NPORT || 30011 ) ; const log = ( msg , extra ? ) => { console . log ( ... [ "(server): " + msg , extra ] . filter ( v => v ) ) ; } ; console . log ( 2 ) ; import { DBObj } from "./DBoGenerated" ; prostgles ( { dbConnection : { host : process . env . POSTGRES_HOST || "localhost" , port : + process . env . POSTGRES_PORT || 5432 , database : process . env . POSTGRES_DB || "postgres" , user : process . env . POSTGRES_USER || "api" , password : process . env . POSTGRES_PASSWORD || "api" , application_name : "hehe" + Date . now ( ) } , io , tsGeneratedTypesDir : path . join ( __dirname + '/' ) , watchSchema : s => { } , sqlFilePath : path . join ( __dirname + '/init.sql' ) , joins : "inferred" , publishRawSQL : async ( socket , db , _db , user ) => { return true ; } , publish : async ( socket , dbo , _db , user ) => { return { various : "*" , } ; } , onReady : async ( db , _db ) => { } , } ) ;