Skip to content
Snippets Groups Projects
Commit da3fdf8a authored by lordjbs's avatar lordjbs
Browse files

3.0

parent b854d60e
No related branches found
No related tags found
No related merge requests found
# Shortnex v2.1BETA
Open Source Shortener, Alpha.
Made with Express and nedb
# Shortnex v3.0
Open Source URL Shortener.
Made with Express and lowdb
# Setup
Basicly, you need NodeJS 9. (8 Works too.)
Basicly, you need NodeJS 9. (8 Works too. Have not tested with other versions, should work tho.)
Do `npm i` for installing all packages.
Delete the conf.json and rename the "conf.EditThisToJSON" to "conf.json" IMPORTANT rename dont use test/tdb.sql & test/users.db use db.db & users.db, the test folder has only test dbs which is not pushed with git.
Than `npm start` and your good to go!
......
{
"init": [
{
"bool":true
}
],
"urls": [
],
"users": [
]
}
\ No newline at end of file
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
const adapter = new FileSync(require("../config.json").db)
const adapter = new FileSync(require("../conf.json").db)
const db = low(adapter)
const database = {
test: function(func) {
func(db.get("initiated").find({bool:true}).value());
},
url: {
add: function(id, url, date, func) {
console.log("ran")
......
......@@ -60,12 +60,12 @@ const port = process.env.PORT || config.port || 8080;
app.listen(port, function () {
ratelimit.start();
startup(port);
startup(port, database);
if(!config.disclaimer.accept) {
console.log("[shortnex] You have not accepted the Disclaimer. Look into the Config.\nThe Process will now automatically end.");
process.exit(1);
}
});
......
const readline = require("readline");
const util = require("../lib/util.js");
module.exports = function(port, database, userdatabase) {
console.log("Shortnex v2.0beta - Made with <3 in Germany by lordjbs");
module.exports = function(port, database) {
console.log("Shortnex " + util.version + " - Made with <3 in Germany by jbs");
setTimeout(function() {
console.log("Listening on Port: " + port)
console.log("Starting db...");
/*database.load(function(response) {
console.log(response);
console.log("Testing database...");
database.test(function(bool) {
if(bool){
console.log("Successfully tested the database");
} else {
console.log("Something is not right with the database. Please look at the database, or contact administrator.");
process.exit(0);
}
});
userdatabase.load(function(response) {
console.log(response);
});*/
console.log("Successful start!");
}, 1000);
}
\ No newline at end of file
module.exports = {
version: "3.0",
isEmpty: function(obj) {
return !Object.keys(obj).length;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment