setup a basket to send back, convert to https

This commit is contained in:
Paul Trowbridge 2019-03-18 17:27:01 -04:00
parent 50c5054e12
commit ecaef0ae4b
3 changed files with 37 additions and 11 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ npm-debug.log
/.vscode
logs.html
stat.html
*.pem

View File

@ -1,5 +1,6 @@
require('dotenv').config();
const express = require('express');
var https = require('https');
var bodyParser = require('body-parser');
const server = express();
const pg = require('pg');
@ -9,6 +10,15 @@ var fs = require('fs');
var readline = require('readline');
//-------------------------------------------------------
var options = {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem'),
passprase: []
};
https.createServer(options,server).listen(3000, () => console.log('started'));
//server.listen(3000, () => console.log('started'))
var Postgres = new pg.Client({
user: process.env.user,
password: process.env.password,
@ -353,4 +363,3 @@ function build_where(req, c, w, d, args) {
return { c, w, d };
}
server.listen(3000, () => console.log('started'))

View File

@ -23,10 +23,10 @@ mseq AS (
--select * from mseq
,base AS (
SELECT
--order_season
--,order_month
--,version
--,iter
order_season
,order_month
,version
,iter
,part_descr
,bill_cust_descr
,ship_cust_descr
@ -37,14 +37,30 @@ FROM
WHERE
where_clause
GROUP BY
--order_season
--,order_month
--,version
--,iter
order_season
,order_month
,version
,iter
,part_descr
,bill_cust_descr
,ship_cust_descr
)
, basket AS (
SELECT
part_descr
,bill_cust_descr
,ship_cust_descr
,SUM(units) units
,SUM(value_usd) value_usd
FROM
base
GROUP BY
part_descr
,bill_cust_descr
,ship_cust_descr
ORDER BY
value_usd desc
)
,months AS (
SELECT
order_season
@ -123,8 +139,8 @@ SELECT
,(SELECT jsonb_agg(row_to_json(months)::jsonb) FROM months)
,'mpvt'
,(SELECT jsonb_agg(row_to_json(mlist)::jsonb) FROM mlist)
,'base'
,(SELECT jsonb_agg(row_to_json(base)::jsonb) FROM base)
,'basket'
,(SELECT jsonb_agg(row_to_json(basket)::jsonb) FROM basket)
,'totals'
,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals)
) package