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 });
|
|
|
|
app.use(bodyParser.json());
|
|
|
|
app.post("/", (req, res) => {
|
|
EventSchema.create(req.body);
|
|
res.send("OK");
|
|
});
|
|
|
|
app.listen(port, () =>
|
|
console.log(`Example app listening at http://localhost:${port}`)
|
|
);
|