made car makes
This commit is contained in:
parent
12b22c6626
commit
9d3f2c7352
2
app.js
2
app.js
@ -23,7 +23,7 @@ app.get('/', (req, res) => {
|
||||
|
||||
app.use('/api/v1/users', userRoutes);
|
||||
app.use('/api/v1/login', loginRoutes);
|
||||
app.use('/api/v1/cars', carsRoutes)
|
||||
app.use('/api/v1/cars', carsRoutes);
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.status(404).json({ message: 'Route not found' });
|
||||
|
||||
@ -4,7 +4,7 @@ const CarMake = require('../models/car_makes.js');
|
||||
// This function retrieves all car makes from the database and sends them as a response.
|
||||
exports.getMakes = async (req, res) =>{
|
||||
try {
|
||||
const makes = await CarMake.find()
|
||||
const makes = await CarMake.find();
|
||||
res.status(200).json(makes);
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@ -3,8 +3,9 @@ const { Schema, model } = require('mongoose');
|
||||
const carMakeSchema = new Schema(
|
||||
{
|
||||
make_name: {
|
||||
type: String
|
||||
type: String,
|
||||
},
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
model.exports = model('CarMake', carMakeSchema);
|
||||
module.exports = model('CarMake', carMakeSchema, 'jdm_makes');
|
||||
Loading…
x
Reference in New Issue
Block a user