You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
574 B

const express = require("express");
const app = express();
const port = 3000;
const bodyParser = require("body-parser");
const mongoose = require("mongoose");
mongoose.connect("mongodb://mongo/events", { useNewUrlParser: true });
const Schema = mongoose.Schema;
const EventSchema = new Schema({}, { strict: false });
const Event = mongoose.model("Event", EventSchema);
app.use(bodyParser.json());
app.post("/", (req, res) => {
Event.create(req.body);
res.send("OK");
});
app.listen(port, () =>
console.log(`Example app listening at http://localhost:${port}`)
);