Skip to content

Express.js is a framework of Node.js for building efficient, scalable Node.js server-side applications. It uses modern JavaScript, is built with JavaScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).

License

sazamansari/node.js-_microservices

Repository files navigation

node.js-_microservices


Description

Express.js is indeed a popular framework for building efficient and scalable server-side applications using Node.js. It is designed to work with modern JavaScript and can be used with pure JavaScript as well. Express.js combines elements of Object-Oriented Programming (OOP), Functional Programming (FP), and Functional Reactive Programming (FRP) to provide a flexible and robust development environment.

While Node.js itself provides compatibility with various libraries, Express.js stands out as a lightweight and flexible framework that simplifies the development of server-side applications. It allows developers to handle routing, middleware, and other server-related tasks with ease.

In recent years, JavaScript has gained significant popularity as a language for both front-end and back-end development, thanks to frameworks like Angular, React, and Vue. However, on the server-side, finding a suitable architecture for Node.js applications has been a challenge.

User_Auth Microservices aims to address this problem by providing an out-of-the-box application architecture. This architecture focuses on creating highly testable, scalable, loosely coupled, and easily maintainable applications. It takes inspiration from the Node.js ecosystem and leverages the power of Express.js along with other libraries and tools to provide a robust solution.

By using User_Auth Microservices, developers can benefit from a pre-defined architecture that promotes best practices and reduces the effort required to build complex server-side applications. This allows developers to focus more on application logic and functionality rather than spending time designing and implementing the underlying architecture.

Overall, Express.js and User_Auth Microservices provide developers with powerful tools and frameworks to build efficient, scalable, and maintainable server-side applications using Node.js and JavaScript.

  1. Make your Changes: Make the necessary changes and improvements to the codebase.

  2. Commit your Changes: Once you're satisfied with your changes, commit them with a meaningful message describing your updates.

git add .
git commit -m 'Add a new feature: detailed explanation'
  1. Push to your Fork: Push your changes to your forked repository on GitHub.
git push origin your-branch-name

License

Include the license information for your project. For example, you can use the MIT License:

This project is licensed under the terms of the MIT License. Feel free to contribute to this repo.

INSTALL

locally, usually for use as a module:

npm i user-auth-microservice

Authors

License

MIT License

API Reference

Get all items

  GET /api/items
Parameter Type Description
api_key string Required. Your API key

Get item

  GET /api/items/${id}
Parameter Type Description
id string Required. Id of item to fetch

Mongoose Connect

config/db.js

import mongoose from "mongoose";

const connectDB = async () => {
  let uri = process.env.MONGO_URI;

  try {
    await mongoose
      .connect(uri, {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        useCreateIndex: true,
      })
      .catch((error) => {
        console.log("connection in error:::", error);
      });

        console.log("mongo DB connected");


      mongoose.set('debug', function(collectionName, method, query, doc, options) {

        console.log(collectionName + '.' + method, JSON.stringify(query), doc)

        // log.info({
        //     dbQuery: set
        // });
    });

  } catch (e) {
    console.error(e, "error");
  } finally {
    // await client.close();
  }
};

export default connectDB;
/>

#### Get all items


#### add(num1, num2)

Takes two numbers and returns the sum.




## To Run The Project

To Run The Project

```bash
  npm run dev

Contributing

Contributions are always welcome!

Note:

  1. Don't Create Pull Request to update "readme.md" File.
  2. Maintain proper folder structure.
  3. In case you need to add an external package, install it by using npm. Don't push the complete package file here

Steps to run the project

  • Fork the repo
  • Clone into local
  • Run npm install
  • Run npm run dev

Issues to fix:

  • Fix all the buttons
  • Improve box-shadow in light mode
  • Make dark mode as default

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Tech Stack

Server: Node.js, Express.js Auth, JwToken

Examples

// Import necessary modules and routes
import CONSTANTS from "../constants/index.js";
import UserRoutes from "../modules/user/user.routes";

/**
 * Configure routes for the Express.js app.
 *
 * @param {object} app - Express.js application instance
 */
const configureRoutes = (app) => {
  // Mount the UserRoutes under the specified API URI
  app.use(`${CONSTANTS.API_URI}/user`, UserRoutes);

  // You can add more routes here as needed
  // Example: app.use(`${CONSTANTS.API_URI}/posts`, PostsRoutes);
};

// Export the configureRoutes function for usage
export default configureRoutes;

(Back to top)

About

Express.js is a framework of Node.js for building efficient, scalable Node.js server-side applications. It uses modern JavaScript, is built with JavaScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published