create method

NodeRoutes create (
  1. List<String> list
)

Implementation

NodeRoutes create(List<String> list) {
  var content = """

const mongoose = require('mongoose');

// Declare the Schema of the Mongo model
var $name = new mongoose.Schema({
 ${list.toList().toString().replaceAll('[', '').replaceAll(']', '')}
});

//Export the model
module.exports = mongoose.model('$name', $name);
  """;
  fileCreate(path + '\\model', content, name + '.js');

  return NodeRoutes(list, name, path);
}