fix tons of bugs!
This commit is contained in:
parent
2a0ca12157
commit
85f37e8f5b
2 changed files with 10 additions and 9 deletions
|
@ -1,16 +1,18 @@
|
||||||
const mainHTML = marked(`# Welcome to ContentCraft!
|
const mainHTML = global.marked.parse(`# Welcome to ContentCraft!
|
||||||
|
|
||||||
ContentCraft is similar to WordPress, except different.
|
ContentCraft is similar to WordPress, except different.
|
||||||
You can do pretty much anything with it using the *"addon-scripts"* folder
|
You can do pretty much anything with it using the *"addon-scripts"* folder
|
||||||
(like this page here, and making other pages!)
|
(like this page here, and making other pages!)
|
||||||
|
|
||||||
We included a few basic libraries in the index.js for you, but feel free to
|
We included a few basic libraries in the index.js for you, but feel free to
|
||||||
add more to your addons, such as quick.db if you need to spin up a database.
|
add more libraries into your addons, such as quick.db if you need to spin up a database.
|
||||||
|
|
||||||
Have a great day.
|
Have a great day.
|
||||||
|
|
||||||
From all of us at Sneed Group.`)
|
From all of us at Sneed Group.
|
||||||
|
|
||||||
|
PS: PRO TIP - USE "global" WHEN YOU WANT TO USE VARIABLES CROSS-ADDON.`)
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
global.app.get('/', (req, res) => {
|
||||||
res.send(mainHTML);
|
res.send(mainHTML);
|
||||||
});
|
});
|
9
index.js
9
index.js
|
@ -1,10 +1,11 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const marked = require('marked'); //note: this is used in other files
|
global.marked = require('marked'); //note: this is used in other files
|
||||||
require('dotenv').config(); // Load environment variables from .env file
|
require('dotenv').config(); // Load environment variables from .env file
|
||||||
|
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const app = express();
|
global.app = express();
|
||||||
const PORT = process.env.PORT || 3000;
|
const PORT = process.env.PORT || 3000;
|
||||||
|
|
||||||
// Specify the folder containing the .js files
|
// Specify the folder containing the .js files
|
||||||
|
@ -31,9 +32,7 @@ fs.readdir(folderPath, (err, files) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create a new function and execute it
|
Function(data)()
|
||||||
const func = new Function(data);
|
|
||||||
func(); // Call the function
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error executing ${file}:`, e);
|
console.error(`Error executing ${file}:`, e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue