start fastify
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import postgres from 'postgres';
|
||||
|
||||
import {parse} from 'csv-parse/sync';
|
||||
|
||||
export const sql = postgres({
|
||||
host: '127.0.0.1',
|
||||
port: 5432,
|
||||
user: 'postgres',
|
||||
password: 'buginoo'
|
||||
});
|
||||
+19
-2
@@ -1,7 +1,24 @@
|
||||
import { ingestOptions, ingestStocks, sql } from './ingest';
|
||||
|
||||
//import { ingestOptions, ingestStocks, } from './ingest';
|
||||
import { sql } from './db.js';
|
||||
/*
|
||||
const sourceDataDir = '/home/avraham/programming/calendar-optimizer-csv';
|
||||
//await ingestStocks(sourceDataDir);
|
||||
await ingestOptions(sourceDataDir);
|
||||
*/
|
||||
|
||||
import fastify from 'fastify'
|
||||
|
||||
const server = fastify()
|
||||
|
||||
server.get('/ping', async (request, reply) => {
|
||||
return 'pong\n'
|
||||
})
|
||||
|
||||
server.listen({ port: 8234, host: '127.0.0.1' }, (err, address) => {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
console.log(`Server listening at ${address}`)
|
||||
})
|
||||
await sql.end({timeout:60});
|
||||
+1
-9
@@ -1,16 +1,8 @@
|
||||
import { join, dirname } from 'node:path'
|
||||
import fs from 'node:fs/promises';
|
||||
|
||||
import postgres from 'postgres';
|
||||
|
||||
import {sql} from './db';
|
||||
import {parse} from 'csv-parse/sync';
|
||||
|
||||
export const sql = postgres({
|
||||
host: '127.0.0.1',
|
||||
port: 5432,
|
||||
user: 'postgres',
|
||||
password: 'buginoo'
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user