how did i live without types

This commit is contained in:
oat 2020-09-02 17:44:44 +03:00
parent 7121c06d7b
commit 46f2168fe5
Signed by untrusted user who does not match committer: oat
GPG key ID: DD83A9617A252385
3 changed files with 65 additions and 4 deletions

View file

@ -52,7 +52,8 @@ db.then(() => {
const app = express();
app.use(express.urlencoded({ extended: true }));
// @ts-ignore
app.use(express.urlencoded({extended: true}));
app.set('db', db);
app.set('config', config);
@ -68,15 +69,16 @@ db.then(() => {
});
app.get('/list', async (req, res) => { // only for testing
let docs = await File.find({});
docs = docs.map(d => {
const docs = await File.find({});
const map = docs.map(d => {
const keys = Object.keys(d.toObject()).filter(k => !k.startsWith('_'));
const obj = {};
for (const key of keys) obj[key] = d[key];
return obj;
});
res.send(JSON.stringify(docs));
res.send(JSON.stringify(map));
});
app.get('/', (req, res) => {