What is wrong with my code?


#1

My error message says “err”:{“message”:“Unexpected token ;”,“name”:“SyntaxError”,“stack”:

This is the code:

var express = require(‘express’);
var router = express.Router();
var Playtests=require(’…/…/models/API Models/Playtests’);

router.get(’/:id?’,function(req,res,next){

if(req.params.id){

    Playtests.getPlaytestById(req.params.id,function(err,rows){

        if(err)
        {
            res.json(err);
        }
        else{
            res.json(rows);
        }
    });
}
else{

    Playtests.getAllPlaytests(function(err,rows){

        if(err)
        {
            res.json(err);
        }
        else
        {
            res.json(rows);
        }

    });
}

});

What is wrong?


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.