Changeset 64dc53b for pages/api/postgre
- Timestamp:
- 06/11/22 23:50:19 (2 years ago)
- Branches:
- main
- Children:
- 4a1a3ca
- Parents:
- 87614a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pages/api/postgre/index.js
r87614a5 r64dc53b 9 9 const Pool = require('pg').Pool 10 10 const pool = new Pool({ 11 connectionString: 'postgres://postgres:postgres@db/postgres'11 connectionString: `postgres://${process.env.POSTGRES_USER}:${process.env.POSTGRES_PASSWORD}@${process.env.POSTGRES_HOST}/${process.env.POSTGRES_DB}` 12 12 }); 13 13 … … 22 22 // } 23 23 24 // update credits in database25 // setInterval(() => {26 // sessions.filter(session => Date.now() - session.lastActivity > 5*60*1000).forEach(session => {27 // pool.query('UPDATE players SET credits = $1 WHERE username = $2', [session.credits, session.username], (error, results) => {28 // if (error) throw error;29 // });30 // });31 // }, 5*60*1000)32 24 33 25 export default function handler(req, res) {
Note:
See TracChangeset
for help on using the changeset viewer.