Init repo with working stuff

This commit is contained in:
unurled 2022-01-27 22:09:00 +01:00
parent 89c4f9a88e
commit 3262dcdb67
4 changed files with 28 additions and 8 deletions

26
README.MD Normal file
View file

@ -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`

View file

@ -4,7 +4,7 @@
"description": "", "description": "",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "nodemon src/index.js" "start": "node src/index.js"
}, },
"author": "unurled", "author": "unurled",
"license": "ISC", "license": "ISC",

View file

@ -8,4 +8,5 @@ const UserSchema = new mongoose.Schema({
}) })
// create a model from schema and export it // 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) module.exports = mongoose.model('user', UserSchema)

View file

@ -11,13 +11,6 @@ async function save(e, btn) {
const jsonFileData = buildJsonFormData(textarea); const jsonFileData = buildJsonFormData(textarea);
const response = await fetchService.performPostHttpRequest('http://localhost:3000/api/post', headers, jsonFileData); 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) { function buildHeaders(authorization = null) {