Skip to content

Streamline API writing with lightning-fast performance. Simplify complex tasks and reduce development time with streamlined code. Boost productivity and efficiency with optimized workflows.

Notifications You must be signed in to change notification settings

Balaji-Rajaram/api-writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Banner

Description

api-writer is a tool for quickly generating a Node.js project with MongoDB integration. It sets up a basic API server using Express.js for routing, MongoDB for data storage, and includes automatic generation of models, controllers, and routes for each module.

Usage

Import package

const apiWriter = require('api-writer');

Define your schema

const modules = [
  {
    name: 'User',
    properties: ['id', 'name', 'email'],
    additionalApis: [
      { method: 'POST', controllerFunction: 'createUser' },
      { method: 'DELETE', controllerFunction: 'deleteUserById' }
    ]
  },
  {
    name: 'Post',
    properties: ['id', 'title', 'content'],
    additionalApis: [
      { method: 'PUT', controllerFunction: 'updatePostTitle' }
    ]
  }
];

Generate project

const projectName = 'projectAlpha';
apiWriter(projectName, modules);

Features

  • Generates a basic Node.js project structure with MongoDB integration.
  • Automatically generates MongoDB models, controllers, and routes for each module.
  • Supports additional APIs for modules.
  • Includes MongoDB configuration.
  • Uses Express.js for routing.
  • Easy to customize and extend.

Project Structure

  • app.js : Main entry point of the application.
  • server.js : Starts the server.
  • dbConfig.js : MongoDB configuration.
  • models/<Module>Model.js : Directory for models
  • routes/<Module>Route.js : Directory for routes
  • controllers/<Module>Controller.js : Directory for controllers.
  • package.json : Project metadata and dependencies.

Contributing

Contributions are welcome! Please submit pull requests to contribute to this project.

Licence

This project is licensed under the MIT License.

About

Streamline API writing with lightning-fast performance. Simplify complex tasks and reduce development time with streamlined code. Boost productivity and efficiency with optimized workflows.

Resources

Stars

Watchers

Forks

Packages

No packages published