Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


12,829 Points

Sequelize/Tables Problem

I'm having a problem with some linked SQL tables, and trying to retrieve data from them with Sequelize. When I'm on DB Browser for SQLite, the tables all exist. But when I try to findAll() or findByPK() my table 'Courses' I'm getting a "SequelizeDatabaseError" with the message: "SQLITE_ERROR: no such table: Courses"

I'll link the repository here: https://github.com/AeronRoemer/rest-api-project

And this is the code from the 'routes' page where the GET request is coming from

const express = require('express');
const router = express.Router();
const Users = require('../models').Users;
const Courses = require('../models').Course;
module.exports = router;

/* Handler function to wrap each route. */
function asyncHandler(cb){
    return async(req, res, next) => {
      try {
        await cb(req, res, next)
      } catch(error){

  //send a GET request to view all quotes
router.get('/courses', asyncHandler(async (req, res) =>{
    let allCourses
    try {
        allCourses = await Courses.findAll();
        res.json(courses) //converts to JSON object
      } catch (error) {
          res.json({error: error,
        message: error.message})