Coder Social home page Coder Social logo

natours-backend's Introduction

Hi there, I'm Arun

I am an enthusiastic selftaught web developer. Insightful and determined programmer with the ability to write clean code.

๐Ÿ’Ÿ Open Source & Community


From time to time I am contributing to open source to improve projects web accessibility. I also have my own open source projects to contribute to. Beginners are welcome.


๐Ÿ’ผ Languages and Tools



I love connecting with different people, so say hi! I'll be happy to meet you more! ๐Ÿ˜Š

My favorite projects ๐Ÿ’ป


ย 


โš™๏ธ GitHub Analytics


Arun Bohra


๐Ÿ“ˆ Contribution Graph


Arun's github activity graph

natours-backend's People

Contributors

arunbohra12 avatar snyk-bot avatar

Stargazers

 avatar

Watchers

 avatar

natours-backend's Issues

Email for dev mode

For sending emails in production, we use SendGrid which comes at a cost.
We need to implement something like Mailtrap or some other service to reduce the SendGrid usage in dev mode.

Create helper function to filter request

Problem

At places, we have the following:
image
This sends the whole request body to the model which can contain keys that we may not want to be changed from the request body.

Solution

We need to create a helper function/class that would provide the option to filter the values (only the ones we need).

Example

// Instead of
const tour = await Tour.create(req.body);

// To use
const filteredBody = filterFunction('name', 'date'); // this would return an object with the specified keys
const tour = await Tour.create(filteredBody);

Delete tours

Provide ability to admins to be able to delete tours.

Filter tours

Create filtering for tours based on the following:

  • Price
  • Date
  • Rating
  • #22

Issue with logger

Describe the bug
Error log seems to not show completely instead shows text "error"
image

To Reproduce
Create any kind of error and log it using logger library.

Expected behavior
It should show a full error object.

Tour ratings

Provide forms for the user (who bought the tour) to leave a rating for that particular tour.

Configure managing secret keys

Problem
Storing encryption keys in a .env file is generally not considered a secure practice. The .env file is typically used for storing configuration variables and should not be used to store sensitive information like encryption keys.

Solution
Configure HashiCorp vault in order to store the keys in a vault instead of a plain text file .env

Add route protection

We need to add middleware/functions for the routes. This will include:

  • Add routes for logged in user
  • Add route for admins

Implement CORS

Implement cors to be able to send requests from clients to the server

  • In the dev mode it should be able to receive requests from all sources
  • In prod, have a whitelist for the allowed origins

Create a logging system

Currently, we use console.log() for error logging what we need is a more robust system for that.

  1. We can use an email system to report critical errors
  2. We can use a logging library eg. Winston, Bunyan for logging less critical errors

Change status value to boolean

In the application, where we want to set status for either response from 3rd party API or sending an answer from our server, we use 0 - failed and 1 - success.

it might be better to use a boolean instead of these status codes, as true & false are more evident.

Tour guides

Add the ability to appoint or remove tour guides.

Send alert emails for errors

Send emails when unexpected things happen on the server.

  • Create an email template for this.
  • Send emails on errors

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.