From 8909076f2ff8efacc8c12acd5e5267f0b0d72cc5 Mon Sep 17 00:00:00 2001 From: Alex Artemov Date: Tue, 14 Nov 2023 15:22:39 -0500 Subject: [PATCH] submit recipe backend --- index.ts | 11 +++++++++-- lib/index.js | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 4c9d87e..179fb3b 100644 --- a/index.ts +++ b/index.ts @@ -1,6 +1,6 @@ import express from 'express' import cors from 'cors' -import { MongoClient } from 'mongodb' +import { MongoClient, ObjectId } from 'mongodb' import 'dotenv/config' const app = express() @@ -13,4 +13,11 @@ app.listen(PORT , () => console.log('Database listening on port', PORT)) app.get('/', (req, res) => { res.json('Here is my API responding') -}) \ No newline at end of file +}) + +app.post('/recipes', (req, res) => { + + const newRecipe = { title: req.body.title, content: req.body.content} + +}) + diff --git a/lib/index.js b/lib/index.js index 117e088..4462e93 100644 --- a/lib/index.js +++ b/lib/index.js @@ -14,3 +14,6 @@ app.listen(PORT, () => console.log('Database listening on port', PORT)); app.get('/', (req, res) => { res.json('Here is my API responding'); }); +app.post('/recipes', (req, res) => { + const newRecipe = { title: req.body.title, content: req.body.content }; +});