diff --git a/.gitignore b/.gitignore index fd4f2b0..17f4e1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules .DS_Store + +# config +config/dev.js diff --git a/config/keys.js b/config/keys.js new file mode 100644 index 0000000..a27a068 --- /dev/null +++ b/config/keys.js @@ -0,0 +1 @@ +module.exports = require("./dev.js"); diff --git a/index.js b/index.js index cada2c0..186365b 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,18 @@ const express = require("express"); const mongoose = require("mongoose"); const bodyParser = require("body-parser"); +const keys = require("./config/keys"); + +// Require models +require("./models/SourceMap"); const app = express(); +mongoose.connect( + keys.mongoURI, + { useNewUrlParser: true } +); + app.use(bodyParser.json()); app.get("/", (req, res) => diff --git a/models/SourceMap.js b/models/SourceMap.js new file mode 100644 index 0000000..0aa5e50 --- /dev/null +++ b/models/SourceMap.js @@ -0,0 +1,18 @@ +const mongoose = require("mongoose"); +const { Schema } = mongoose; + +const sourceToContentInfoSchema = new Schema({ + mediaId: String, + contentId: { + type: Schema.Types.ObjectId, + ref: "Content" + } +}); + +const sourceMapSchema = new Schema({ + name: String, + url: String, + availableContent: [sourceToContentInfoSchema] +}); + +mongoose.model("sourceMaps", sourceMapSchema);