1const express = require("express");
2const route = express.Router();
3const mongoose = require("mongoose");
4const Schema = mongoose.Schema;
5
6const noteSchema = new Schema({
7 note: {
8 type: String,
9 required: true
10 },
11
12});
13const noteModels = mongoose.model("note", noteSchema);
14
15route.post("/", async (req, res) => {
16 const note = new noteModels({
17 note: req.body.note,
18 });
19
20 const saveNote = await note.save();
21 res.json(saveNote);
22 })
23
24module.exports = route;