app.delete raise syntax error on express with nodeclipse IDE
-
21-12-2019 - |
Pergunta
does anyone familiar with this error on nodeclipse IDE ?
app.delete('/delete', function(req, res) {
....
});
Syntax error on token ".", , expected
Solução
delete
is a reserved word in JavaScript. In express
, you should use app.del(...)
. For you example, the following code should work:
app.del('/delete', function(req, res) {
...
});
Outras dicas
try
app['delete'](...)
delete is a reserved word in old ES versions,so unless nodeclipse supported ES5 it may raise an error.
If nodeclipse works with jslint ,write at the top of your file
/*jslint es5:true*/
and it should remove the error.
delete
was reserved word before EcmaScript 5.
Nodeclipse by default uses Eclipse JSDT-based Editor, that is not EcmaScript 5 aware (but JSHint integration is)
This is issue #70.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow