List implemented
This commit is contained in:
5
app.ts
5
app.ts
@@ -5,12 +5,12 @@ import * as low from "lowdb";
|
||||
import * as FileSync from "lowdb/adapters/FileSync";
|
||||
import * as logger from "morgan";
|
||||
import * as path from "path";
|
||||
import * as read from "read-file";
|
||||
import * as uuidv4 from "uuid/v4";
|
||||
|
||||
import * as indexRouter from "./routes/index";
|
||||
import * as updateRouter from "./routes/update";
|
||||
import * as usersRouter from "./routes/users";
|
||||
import * as read from "read-file";
|
||||
|
||||
const app = express();
|
||||
const adapter = new FileSync("db.json")
|
||||
@@ -26,6 +26,7 @@ app.cocktails = [];
|
||||
|
||||
read("data/output.csv", "utf8", (err, buffer) => {
|
||||
// console.log(buffer);
|
||||
const cocktailList = [];
|
||||
let result = buffer.split(/\n|\r|\n\r|\r\n/);
|
||||
result = result.map((line) => {
|
||||
line = line.split("\t");
|
||||
@@ -36,10 +37,12 @@ read("data/output.csv", "utf8", (err, buffer) => {
|
||||
line[1] = parseFloat(line[1]);
|
||||
line[4] = `${line[4].substr(0, line[4].length - 2)},${line[4].substr(-2)} €`;
|
||||
line[5] = `${line[5].substr(0, line[5].length - 2)},${line[5].substr(-2)} €`;
|
||||
cocktailList.push(line[3]);
|
||||
return line;
|
||||
});
|
||||
result = result.filter((f) => !!f);
|
||||
app.cocktails = result;
|
||||
app.cocktailList = cocktailList;
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user