当我发送请求时,我尝试渲染事件以对其进行编辑以提供事件信息,但是页面仅加载html并收到以下错误:
<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!' );
});
});
// static files
app.use( express.static( path.join( __dirname, '/public' ) ) );