Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/console.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import repl from 'repl'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace 'repl' with "repl";

Suggested change
import repl from 'repl'
import repl from "repl";

import app from '../src/app.js'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace '../src/app.js' with "../src/app.js";

Suggested change
import app from '../src/app.js'
import app from "../src/app.js";


Object.assign(repl.start().context, {
app,
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"sqlite3": "^5.1.1"
},
"scripts": {
"server": "node src/index"
"server": "node src/index",
"console": "node bin/console"
}
}
18 changes: 18 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import cors from 'express'
import express from 'express'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace 'express' with "express";

Suggested change
import express from 'express'
import express from "express";

import sqlite from 'sqlite3'
import ejs from 'ejs'

const db = new sqlite.Database('../db.sqlite')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace '../db.sqlite') with "../db.sqlite");

Suggested change
const db = new sqlite.Database('../db.sqlite')
const db = new sqlite.Database("../db.sqlite");


const app = express()

app.db = db

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
app.db = db
app.db = db;


app.set('view engine', 'ejs')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace 'view·engine',·'ejs') with "view·engine",·"ejs");

Suggested change
app.set('view engine', 'ejs')
app.set("view engine", "ejs");


app.get('/', function(request, response) {
response.render('index')
})

export default app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
export default app
export default app;

16 changes: 2 additions & 14 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import cors from 'express'
import express from 'express'
import sqlite from 'sqlite3'
import ejs from 'ejs'
import app from './app.js'

const db = new sqlite.Database('../db.sqlite')

const app = express()
const port = 4004

app.set('view engine', 'ejs')

app.get('/', function(request, response) {
response.render('index')
})

app.listen(port, function() {
console.log(`Listening on port ${port}`)
})

db.close()
app.db.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
app.db.close()
app.db.close();