diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..2a1e0c7 --- /dev/null +++ b/README.MD @@ -0,0 +1,26 @@ +# Text-display :) + +havn't throught of any better name sooo... + +making it working : + - download nodejs + - download or setup on cloud a mongodb database + - add to mongodb an entry: (will be making a proper way to do it in the future maybe not so shure) + ``` + { + "_id": { + "$oid": "id generated uhm google it" + }, + "name": "Username", + "pass": "Password", + "text": "text" +} +``` + - change http://localhost:3000 to your url and stuff in : + - `src/index.js:49:12` and `src/index.js:49:31` + - `src/text.js:7:19` to your username (need to access mongodb) + - `src/public/getText.js:13:60` + - `src/public/main.js:13:65` + - `src/config/db.config.js:5:17` link to your mongodb database url + - `npm i` + - `npm start` \ No newline at end of file diff --git a/package.json b/package.json index 481413d..8eb83f3 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "src/index.js", "scripts": { - "start": "nodemon src/index.js" + "start": "node src/index.js" }, "author": "unurled", "license": "ISC", diff --git a/src/model/user.js b/src/model/user.js index ac66bf4..923f982 100644 --- a/src/model/user.js +++ b/src/model/user.js @@ -8,4 +8,5 @@ const UserSchema = new mongoose.Schema({ }) // create a model from schema and export it +// user here is the collection name modify it if you want module.exports = mongoose.model('user', UserSchema) \ No newline at end of file diff --git a/src/public/main.js b/src/public/main.js index a0c3066..60e775c 100644 --- a/src/public/main.js +++ b/src/public/main.js @@ -11,13 +11,6 @@ async function save(e, btn) { const jsonFileData = buildJsonFormData(textarea); const response = await fetchService.performPostHttpRequest('http://localhost:3000/api/post', headers, jsonFileData); - if(response) { - document.getElementById("response").innerHTML = response.hello; - document.getElementById("response").innerHTML = "hallooooo"; - document.innerHTML += "hellloooo"; - } - else - alert(`An error occured.`); } function buildHeaders(authorization = null) {