节点/表达问题试图呈现页面

时间:2020-06-26 08:16:02

标签: node.js express

当我发送请求时,我尝试渲染事件以对其进行编辑以提供事件信息,但是页面仅加载html并收到以下错误:

Errors

<a href="/edit-event/{{ id }}" class="btn btn-secondary">Edit</a>
    
router.get('/edit-event/:id', (req, res) => {
    db.ref( 'events/' + req.params.id ).once( "value" ).then( ( snapshot ) => {

          res.render( 'showEvent', { body : snapshot.child( 'info' ).val() } );

     }).catch( function( error ) {
          res.status( 500 ).send( 'something wrong!' );
    }); 
});

css files

// static files
app.use( express.static( path.join( __dirname, '/public' ) ) );

0 个答案:

没有答案