-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
48 lines (35 loc) · 1.09 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Select the correct environment that the app is running in
// By default, select "development"
const env = process.env.NODE_ENV || "development";
// Require the configuration set in the knexfile, access
// the correct configuration for the environment selected
const config = require("./knexfile")[env];
// Create a connection called knex
const knex = require("knex")(config);
const items = require("./models/items.model");
const run = async () => {
// call your functions in here
};
const createItemsTable = async () => {};
const dropItemsTable = async () => {};
const getAllItems = async () => {};
const insertManyItems = async (manyItems) => {};
const newItem = async (newItem) => {};
const getItemById = async (id) => {};
const updateItem = async (id, item) => {};
const deleteItem = async (id) => {};
// keep the function invocation at the bottom of the file, below all other function expressions
if (env === "development") {
run();
}
module.exports = {
knex,
createItemsTable,
deleteItem,
dropItemsTable,
getAllItems,
getItemById,
insertManyItems,
newItem,
updateItem,
};