📅  最后修改于: 2022-03-11 14:55:00.108000             🧑  作者: Mango
// MyModel.js
import fs = require('fs');
import xml = require('xml')
import csv = require('csv')
export function import(info, callback) {
// Get the current database connection.
var ds = this.dataSource.connector;
// ***********************************************
// ** READ FILES AND WRITE TO THE DATABASE HERE **
// ***********************************************
// --->
// ***********************************************
// Return results and/or error information.
return callback(null, data)
}
export function remoteMethod(model: any) {
model.remoteMethod(
'import',
{
http: { verb: 'get' },
accepts: {arg: 'info', type: 'data' },
returns: [
{ arg: 'info', type: 'data' },
{ arg: 'data', type: 'data' }
]
}
)
return model;
}