GithubHelp home page GithubHelp logo

electrico_backend's Introduction

To make changes

1

In config.env file add
1. MongoDB link
2. DB Password
3. DB Username

2

In server.js file change path to ./config.env

To run

npm install
npm start

API Documentation

FOR USERS

To add new Complaints

POST request /api/v1/shop
DATA
{
    "name": String Required
    "phoneNumber": Number Required
    "appliance": String Required
    "problem": String Required
    "address": String Required
    "pincode": Number Required
}

If successful

response from server :
status code: 201
{
    status: 'Ok',
    data: {
    customerData (That data that you have posted)
    }
}

If unsuccessful

status 400
{
    status: 'Fail',
    message: err.message,
}

To get complaints of users

GET request /api/v1/shop/<PHONENUMBER>
user phoneNumber
if phoneNumber is present then User will receive all his Complaints
DATA
{
    "name": String
    "phoneNumber": Number
    "appliance": String
    "problem": String
    "address": String
    "pincode": Number
    "resolved": Boolean
    "createdAt": DATE
}

if phone Number is not present then

DATA
{
    "status": "Fail",
    "message": "Page not found" 
}

FOR ADMINS

To Login

POST request at /api/v1/shop/admin/user/login
DATA
{
    "username": String Required
    "password": String Required
}

IF successful LOGIN

Response from server
{
    status: 'Ok',
    message: 'Login Successful',
}

If unsuccessful LOGIN

status: 403
{
    status: 'Fail',
    message: err.message,
}

To show all Complaints

GET request at /api/v1/shop/admin/
DATA
{
    "name": String
    "phoneNumber": Number
    "appliance": String
    "problem": String
    "address": String
    "pincode": Number
    "resolved": Boolean
    "createdAt": DATE
}

To resolve a complaints

POST request at /api/v1/shop/admin/<ID>
ID of that complaint
{
"resolved": true
}

If successful

RESPONSE From server
{
    status: 'Ok',
    data: {
    customerData
    }   
}

if unsuccessful

{
    status: 'Fail',
    message: err.message
}

electrico_backend's People

Stargazers

 avatar

Watchers

 avatar

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.