creator: caztspace
thx for you coding!
download the project, install the corresponding dependencies, run the following command:
npm run devAnd open in your browser the localhost:4000.
a web site to save usernames in txt files, allows you to download this log and delete it when you see fit.
usinf "fs" library for write, delete and update txt file.
npm install fs
const fs = require('fs');const express = require('express');
const fs = require('fs');
const query = express();
const write = query.post('/file', (req, res) => {
datos = req.body
let name = 'user: ' + datos.user
let pass = 'password: ' + datos.pass
if (datos.user == '' || datos.pass == ''){
console.log('void');
} else {
fs.appendFile('./src/info.txt', '\n' + name + '\n' + pass + '\n', (err) => {
if (err) {
console.log(err);
}
const users = fs.readFileSync('./src/info.txt', 'utf-8')
const lines = users.split('\n')
for (const line of lines){
console.log(line);
}
res.redirect('/');
})
}
})
module.exports = write;
