Git Product home page Git Product logo

13-14-relationship-mapping's Introduction

Lab 13-14 - Relational Mapping

Author: Mario Flores Jr.

Version: 1.0.0

Overview

This lab is a server build-up using Express and MongoDB. The router makes requests to endpoints, utilizing the Castle schema as a model for the data. The database is a MongoDB Cloud remote deployment.

Functionality

  1. To utilize MongoDB, ensure that link to database is entered into MONGODB_URI in the .env and test.env.js files using the following link:

mongodb://username:[email protected]:63769/11-express

*Must obtain specific username and password from author.

  1. To POST a new Castle to the database, make a POST request. Successful posts will return a 200 status code to the logs and will send a response to the MongoDB with id.

castleRouter.post('/api/castle', jsonParser, (request, response, next) =>

  1. To make a GET request, utilize the id endpoint to retrieve the specific Castle of your choosing. If successful, a 200 status code is logged and a response sent. If id doesn't exist, a 404 status will be sent.

castleRouter.get('/api/castle/:_id', (request, response, next) =>

  1. To make an update to the database, utilize the PUT request along with the id of the Castle instance you wish to update. If successfully updated, a 200 status code is returned with updated json. If id doesn't exist or failure to update, a 404 status is sent.

castleRouter.put('/api/castle/:id', jsonParser, (request, response, next) =>

  1. To DELETE a Castle, make the request with the specific id endpoint. A 200 status code is then logged, along with a response notifying of the deletion. A 404 status code is sent if the Castle does not exist.

castleRouter.delete('/api/castle/:_id', (request, response, next) =>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.