Skip to content

Commit 46cc3be

Browse files
committed
moar
1 parent 1d293ad commit 46cc3be

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

migrate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var knex = require("knex")({
44
client: "pg",
5-
connection: process.env.DATABASE_URL || "postgres://ebaujsbvecjlzi:12edc63ce7e4c9ec49b6b97c6321fb42c0c1f2651f364bf61cbfad275222799b@ec2-23-21-171-25.compute-1.amazonaws.com:5432/dutnhmhd1tnph",
5+
connection: process.env.DATABASE_URL,
66
});
77

88
knex.schema.hasTable("accounts").then(function(exists) {

server.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const Hapi=require('hapi');
44

55
const port = +process.env.PORT || 5000;
66
const host = "0.0.0.0";
7+
const knex = require(knex);
78

89
// Create a server with a host and port
910
const server = Hapi.server({
@@ -27,6 +28,21 @@ const start = async function() {
2728
}
2829
});
2930

31+
// Add the accounts getter
32+
server.route({
33+
method:'GET',
34+
path:'/accounts',
35+
handler: (request,h) => {
36+
var pg = knex({
37+
client: "pg",
38+
connection: process.env.DATABASE_URL,
39+
});
40+
return pg("accounts").then(results => {
41+
return results;
42+
});
43+
}
44+
});
45+
3046
// Add the favicon route
3147
server.route({
3248
method:'GET',

0 commit comments

Comments
 (0)