Giter Club home page Giter Club logo

code-kitty-api's Introduction

Code Kitty API

How to start backend server

  1. Open Terminal
  2. yarn install or npm install
  3. yarn run dev or npm run dev

Installation of ts-node:

Since we are using NodeTS in our project, we will have to separately install this as a dependency.

Run npm install -g ts-node

You should get the following output on the terminal/git bash:

Code Kitty Server is listening on 4000

Connected to MongoDB!

code-kitty-api's People

Contributors

banujan6 avatar chamodshehanka avatar khan9920 avatar safnaj avatar sewvandiii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

code-kitty-api's Issues

[Clarification] Should I use Mongoose or MongoDB Client methods?

In user.class.ts we are defining Mongoose ORM

export const UserSchema = new mongoose.Schema({
    _id: mongoose.Schema.Types.ObjectId, required: true,
    displayName: { type: String, required: true },
    email: { type: String, required: true },
    photoURL: { type: String, required: true },
});

But, In the user.controller.ts, we never use ORM and we directly using MongoDB Client instead.

public addUser = async (req: Request, res: Response): Promise<any> => {
    const collection = getCollection();
    const user = req.body;
    try {
        const result = await collection.insertOne(user);
    } catch (error) {
            
    }
}

So my doubt is If we are not using ORM why are we defining them? Should I use Mongoose or Mongo Client directly?

Implement Category Endpoint

Implement Category Endpoint

All Create, Read, Update, Delete endpoints need to be implemented.

  1. Clone the repo
  2. Go to Mongo DB Cloud and create a Database
  3. Create a .env file in the root directory
  4. Add Below lines in .env file

    PORT=4000

    MONGO_DB_URI=<YOUR MONGO DB URL>
  5. Make CRUD for category
  6. Include Postman Screenshots with the Pull Request

Implement Post Endpoints

Implement Post Endpoint

All Create, Read, Update, Delete endpoints need to be implemented.

Post Attributes

description: string;
imageURL: string;
createdDate: string;
userId: string;
categoryName: string;
  1. Clone the repo
  2. Go to Mongo DB Cloud, create a Database, and get the Connection URL
  3. Create a .env file in the root directory
  4. Add Below lines in .env file

    PORT=4000

    MONGO_DB_URI=<YOUR MONGO DB URL>
  5. Make CRUD for Post
  6. Include Postman Screenshots with the Pull Request

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.