So basically I wrote a simple API where you can perform http POST and http GET on a nedb. My problem however is, that after posting an entry (customer), the entry appears in the nedb file but when I use the GET method it isn't returned.
However after restarting the API it works as expected and the expected data is returned. But why does it have to restart in order to "refresh" the data?
Get-Function:
const db = new Datastore({filename: __dirname + '/db.dat', autoload:true});
export function getAll(req: Request, res:Response, next: Next):void{
db.find({}, (err, customers) => {
res.send(customers);
});
next();
}