Hi everyone,
What would be the proper way to set up Mongo models and documents in Glitch? From the fcc examples, I’ve seen, it’s through an endpoint but when I run it, nothing is added in mLabs
This is what I’m trying: https://glitch.com/edit/#!/fcc-lxm-shortener?path=server.js:29:8
app.get('/setup',(req, res) => {
console.log('in /setup');
var Schema = mongoose.Schema;
var recordSchema = new Schema(
{
name : {
type: String,
required: true},
id : {
type: Number,
required: true},
})
var UrlEntry = mongoose.model('UrlEntry', recordSchema);
var entry = new UrlEntry({url: 'https://www.reddit.com/r/goldenretrievers/', id: 1})
entry.save()
res.send("ok")
})