filter with date ; working backend and frontend
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
const express = require('express');
|
||||
const config = require('./config');
|
||||
|
||||
var MongoClient = require ('mongodb').MongoClient;
|
||||
var ObjectID = require ('mongodb').ObjectID;
|
||||
|
||||
const app = express();
|
||||
|
||||
app.listen(config.PORT, ()=>{console.log('Server running on port ' + config.PORT)});
|
||||
app.get('/list', (req,res)=>{
|
||||
res.header ('Access-Control-Allow-Origin', '*');
|
||||
db.collection('expired_list').find({}).toArray((err,result)=>{
|
||||
if (err){
|
||||
res.send(JSON.stringify(null));
|
||||
}else{
|
||||
res.send(JSON.stringify(result));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
MongoClient.connect (config.databaseURL).then (database => {
|
||||
db = database;
|
||||
app.listen(config.PORT, ()=>{console.log('Server running on port ' + config.PORT)});
|
||||
});
|
||||
Reference in New Issue
Block a user