Ironhack Day 22

Node JS

1. Using render instead of get:

> // require the Drone model here

const router = express.Router();

router.get(’/drones’, (req, res, next) => {
// Iteration #2
router.get(’/’, (req, res, next) => {
Drone.find({}, (err, drones) => {
console.log(drones);
if(err) {next(err);} else {
res.render(’drones/index’, {drones:drones});

A shorter way of writing this is: res.render(’drones/index’, {drones});

2. Node JS tutorials on Youtube: The Net Ninja – Node JS Tutorial for Beginners

Vastaa

Sähköpostiosoitettasi ei julkaista. Pakolliset kentät on merkitty *