我正在玩一个简单的html表单,试图解析表单数据。不幸的是,我的路由部分只返回我的表单元素中的未定义
我的app.js
-(void)Timer{
//num is a slider value
num1 = num*60.0;
self.ShowerTimer = [NSTimer scheduledTimerWithTimeInterval:num1
target:self
selector:@selector(notification)
userInfo:nil
repeats:YES];
}
玉形,
-(void)notification{
//NSDate *alarmTime = [[NSDate date] dateByAddingTimeInterval:num];
UIApplication *app = [UIApplication sharedApplication];
UILocalNotification *notifyAlarm = [[UILocalNotification alloc] init];
// get current date/time
NSDate *today = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// display in 12HR/24HR (i.e. 11:25PM or 23:25) format according to User Settings
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString *currentTime = [dateFormatter stringFromDate:today];
//NSLog(@"User's current time in their preference format:%@",currentTime);
notifyAlarm.fireDate = [NSDate dateWithTimeIntervalSinceNow:0];
notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
notifyAlarm.repeatInterval = 0;
notifyAlarm.soundName = @"";
notifyAlarm.alertBody = [NSString stringWithFormat:@"Notified at %@",currentTime];
[app scheduleLocalNotification:notifyAlarm];
}
我的路线,
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var busboy = require('connect-busboy');
var routes = require('./routes/index');
var users = require('./routes/users');
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
module.exports = app;
答案 0 :(得分:0)
您的表单有multipart/form-data
enctype:
form(method='post', action='/contact', enctype="multipart/form-data")
但由于它是here,body-parser
不会处理这类机构:
由于它们复杂且通常较大,因此不能处理多部分主体。对于多部分机构,您可能感兴趣 以下模块:
或者您应该将中间件更改为解析正文或表单enctype
。