我想在grails 3.3.9版本的bootstrap.groovy文件中添加一个文件。 在bootstrap.groovy中:
Route::group(['prefix' => 'api/v1'], function () {
\Log::info('step 1');
Route::middleware('auth:api')->group(function () {
\Log::info('step 2');
Route::get('/products','APIController@getProducts');
Route::get('/logout','PassportController@logout')->name('logout');
});
});
执行run-app时,出现以下错误
package com.nuevaconsulting
import com.nuevaconsulting.embrow.*
class BootStrap {
def init = { servletContext ->
def filePath = "C:/Grails/embrow/grails-app/conf/resourcesresources/1.csv"
new File(filePath).splitEachLine(',')
{
fields ->
def employee = new Employee(
mirId: fields[0].trim(),
cancer : fields[1].trim(),
profile : fields[1].trim(),
pubmed : fields[1].trim()
)
if ( employee.hasErrors() || employee.save(flush: true) == null) {
log.error("Could not import employee ${ employee.errors}")
}
log.debug("Importing employee ${ employee.toString()}")
}
def destroy = {}}}
如何添加和可视化?