×
  • Healthcare
  • Services
    • E-Commerce Website Development
    • E-Learning Platform
    • Website Development
    • Custom ERP Development
    • Web Designing
    • Job Portal Software Development
  • Casestudy
    • Digitalise your business with e-commerce website
    • ERP system for textile industries
    • All-inclusive e-learning platform custom made to meet your needs
    • Fitness case study – Online Fitness Software for DavidCosta
    • Recruitment Software And Management System To Stay Ahead Of Market Competition
  • Industry
    • Education & E-Learning
    • Textile Solutions
    • Retail Industry
    • Fitness & Training
    • Recruitment
  • Blog
  • Contact Us
  • Career
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
☰

Knovator Technologies

Web and App Solutions

  • Services
    • First Sub Menu
      • Website Development
        Website Development To create unique online presence.
      • E-Commerce Development
        E-Commerce Development For online stores, customer-centric solutions & more.
      • E-Learning Platform
        E-Learning Platform Expert E-Learning Platform dev for online education.
    • Second
      • Custom ERP Development
        Custom ERP Development Expert ERP dev for unique business solutions, streamline operations & more.
      • Web Designing
        Web Designing For stunning online visuals, attractive, and user-friendly.
      • WordPress Plugin Development
        WordPress Plugin DevelopmentExpert WordPress plugin dev for custom functionality.
  • Casestudy
  • Industry
    • First Sub Menu
      • Education & E-Learning
        Education & E-Learning Empowering education with interactive learning experiences
      • Textile Solutions
        Textile Solutions Grow using innovative and automated ERP solutions
      • Retail Industry
        Retail Industry Optimizing the retail experience using technology
    • Second
      • Fitness & Training
        Fitness & TrainingEngaging, interactive solutions for fintess institution
      • Recruitment
        Recruitment Job Portal for efficient talent acquisition & hiring process
  • Case Study
  • Products
    • First Sub Menu
      • Recruitment
        Job Board Software Designed to adapt and grow with your needs
    • Second
      • Learning Management System
        Learning Management System Built to handle growth and adapt to changing needs
  • Blog
    • First sub menu
      • Healthcare
        Healthcare Get insights from our blogs on the new technical developments
    • Second
      • Education & E-Learning
        Education & E-Learning Discover the latest industry trends for cutting-edge education & elearning solutions.
    • third
      • Healthcare
        Recruitment Expert guidance on job portal development for an efficient and effective hiring process
  • Career
  • Contact Us
Streamline All Your App Development Needs With Knovator Masters Pack
Free and open-source software

Home » Blog » Streamline All Your App Development Needs With Knovator Masters Pack

Streamline All Your App Development Needs With Knovator Masters Pack

November 23rd, 2022 3 mins
Share
Faster application development with knovator masters package Part 1 - Knovator Technologies

Have you ever noticed re-building masters functionality every time in your new application? Yes, we also noticed it. That’s why we build @knovator/masters-node and @knovator/masters-admin so that you don’t have to build them from scratch.

The masters’ package is the combination of two packages, @knovator/masters-node for the Backend and @knovator/masters-react for the Frontend.

@knovator/masters-node

Setup

Masters node adds master routes to your NodeJS application. To create a NodeJS application follow the below steps

 mkdir node-app 
    cd node-app 
 yarn init -y 
yarn add express mongoose @knovator/masters-node 

We have the application setup ready, let’s create one src/db.js file that will connect to the database,

// src/db.js
const mongoose = require('mongoose');

mongoose
  .connect('mongodb://localhost:27017/knovator')
  .then(() => console.info('Database connected'))
  .catch((err) => {
    console.error('DB Error', err);
  });

module.exports = mongoose;

@knovator/masters-admin package provides a facility to upload an image for submaster, so let’s create a route for it.

// src/fileRoute.js
const express = require('express');
const router = express.Router();

router.post(`/files/upload`, (req, res) => {
    // TO DO: some file storage operation
    let uri = "/image.jpg";
    let id = "62c54b15524b6b59d2313c02";
    res.json({
      code: 'SUCCESS',
      data: { id, uri },
      message: 'File uploaded successfully'
    });
});

router.delete(`/files/remove/:id`, (req, res) => {
    // TO DO: some file remove operation
    res.json({
        code: 'SUCCESS',
        data: {},
        message: 'File removed successfully'
    })
})

module.exports = router;

Now let’s create an app.js file that starts our application,

  require('./src/db');

  const cors = require('cors');
  const express = require("express");
  const fileRoutes = require('./fileRoute.js');
  const PORT = 8080;

  const app = express();
  app.use(cors());
  app.use(express.static("public"));
  app.use(fileRoutes);

  // ...
  app.listen(PORT, () => {
      console.log(`App started on ${PORT}`);
  });

Usage

Are you ready with the setup? Great, using the masters-node package is very easy to use. Just add masters to app.use.

  const { masters } = require('masters-node');

  app.use("/admin/masters", masters());
  app.listen(PORT, () => {
      console.log(`App started on ${PORT}`);
  });

Do you want customization we got your back. We can customize the following parameters to it.

  • authentication – Provides the ability to add authentication to routes
  • logger – Provides the ability to add logging for Database and Validation, default is console
  • catchAsync – Wraps functions to handle async errors
  • convertToTz – Provides the ability to convert dates to other timezones

For Example,

app.use("/admin/masters", masters({
  authentication: (req, res, next) => {...},
  logger: console,
  catchAsync: (function) => (req, res, next) => {...},
  convertToTz: ({ tz, date }) => {...}
}));

If you want to use the Master modal somewhere else in your Application. For example, Give a relationship between the Master and User, you can import Master model and use it.

import { Master } from '@knovator/masters-node';

Found useful to you? Please give it a try and feel free to contact us if found any issues.

facebook-icon twitter-icon pintrest-icon instagram-icon
Bhavik Chavda
Bhavik Chavda
facebook-icon twitter-icon linkedin-icon
Passionate full stack developer with specialization in JavaScript, NodeJS and ReactJS. Well versatiled in developing Full Stack Applications, Building features and Writing optimized code.

Related Articles

Faster application development with knovator/masters package Part – 2

Faster application development with knovator/masters package Part – 2

This is Part 2 of using @knovator/masters in your application so that you don’t have to build masters from scratch...

Free and open-source software
13 Sep 2022
Automate the process of image resizing with @knovator/image-resizer

Automate the process of image resizing with @knovator/image-resizer

Do you ever encounter a situation where a user uploads one image and you have to change its resolution to show it in mul...

Free and open-source software
12 Sep 2022
X
Request a Free Quote
Expert Tech Guidance
Industry Research
Free Project Estimation
Dedicated Support
  • Max. file size: 100 MB.
  • This field is for validation purposes and should be left unchanged.

Looking to build a web or
mobile app?
Find how we helped 100+ clients in building web and mobile
apps at a low cost!

Request a FREE Quote
Whats App
Together we can do great things.

Get free technical consultation

Speak to our experts to get the customised app, a timeline for the project and the costing.

Get your app faster

Instant prototype, faster application development and delivery.

Aftercare

We will maintain your project to keep it running smoothly.
Get in touch with us
  • This field is for validation purposes and should be left unchanged.

knovator logo
1st Floor, B/45-46 Ram Krishna Society, Lambe Hanuman Rd, Near Ram Krushna School, Surat, Gujarat 395006
561 bridge ave, Windsor Ontario,
N9B 2M3, Canada
+91-94995 01397
[email protected]
[email protected]
DMCA.com Protection Status
About Us
  • Blog
  • Career
  • Contact Us
  • Privacy Policy
Our Services
  • Custom ERP Development
  • Website Development
  • E-Commerce Website Development
  • E-Learning Platform
  • Web Designing
Products
  • Job Board Software
  • Learning Management System
Industry Expertise
  • Education
  • Textile
  • Retail
  • Fitness & Training
  • Recruitment
Resources
  • How To Know If A Free WordPress Plugin Is Worth Using
  • How to Use an LMS in Your Onboarding Process
  • Kickstart Your Recruitment Business With A Seasoned Job Portal Development Company
  • How Technology Is Transforming The Education Sector

Copyright © 2023 · All Rights Reserved by Knovator Technologies