mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
Update JavaScript examples to latest Railway (#14)
* update serverless pg example * update nextjs example * update prisma example
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"global": "^4.4.0",
|
||||
"railway": "^2.0.5",
|
||||
"pg": "^8.4.0",
|
||||
"tslib": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const pg = require("railway/pg");
|
||||
const pg = require("pg");
|
||||
const client = new pg.Pool();
|
||||
|
||||
pg.query("SELECT now()", (err, res) => {
|
||||
client.query("SELECT now()", (err, res) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
@@ -8,4 +9,4 @@ pg.query("SELECT now()", (err, res) => {
|
||||
console.log(res.rows);
|
||||
});
|
||||
|
||||
pg.close();
|
||||
client.close();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "9.5.0",
|
||||
"railway": "^2.0.5",
|
||||
"pg": "^8.4.0",
|
||||
"react": "16.13.1",
|
||||
"react-dom": "16.13.1"
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
// Call Railway anywhere on serverside code.
|
||||
// Here or getInitialProps
|
||||
|
||||
import pg from "railway/pg";
|
||||
import { promisify } from "util";
|
||||
import pg from "pg";
|
||||
|
||||
export default async (req, res) => {
|
||||
try {
|
||||
const query = await promisify(pg.query)("Select NOW()");
|
||||
const client = pg.Pool();
|
||||
const query = await promisify(client.query)("Select NOW()");
|
||||
res.json({
|
||||
data: {
|
||||
time: query.rows[0].now,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@prisma/cli": "^2.1.3",
|
||||
"railway": "^2.0.5",
|
||||
"ts-node": "^8.10.2",
|
||||
"typescript": "^3.9.7",
|
||||
"yarpm": "^0.2.1"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user