Skip to content

Conversation

@qr8r
Copy link
Owner

@qr8r qr8r commented Oct 26, 2022

I wanted to start a console with our app loaded for easier debugging of
stuffs.

To do this I need app to be available for export without starting the
server.

The app can now be started in a repl consol locally with yarn console.

The app object is made available to the local context

@qr8r qr8r requested a review from JoshuaWhite1 October 26, 2022 21:51
qr8r added 2 commits October 26, 2022 18:06
I wanted to start a console with our app loaded for easier debugging of
stuffs.

To do this I need app to be available for export without starting the
server.

This commit moves the app definition into its own file which can be
required separately
This is a command that will start a REPL. The app can be loaded into the
repl context with:

import('<path to app.js>')
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");

})

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();

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;


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");


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;

@@ -0,0 +1,6 @@
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";

@@ -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";

@@ -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";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants