backend library now complete
This commit is contained in:
@@ -10,7 +10,7 @@ const router = express.Router();
|
||||
2nd param = middlewares (optional)
|
||||
3rd param = request & response function (controller)
|
||||
*/
|
||||
router.get('/', (request, response, next) => next(), getExamples); // current path: http://localhost:8080/example
|
||||
router.post('/upload', (request, response, next) => next(), uploadExample); // current path: http://localhost:8080/example/upload
|
||||
router.get('/', (request, response, next) => next(), getExamples); // current path: http://localhost:8080/api/v1/example
|
||||
router.post('/upload', (request, response, next) => next(), uploadExample); // current path: http://localhost:8080/api/v1/example/upload
|
||||
|
||||
export default router;
|
||||
@@ -2,7 +2,7 @@ import mongoose from 'mongoose'; // MongoDB (database)
|
||||
import express from 'express'; // Backend App (server)
|
||||
import dotenv from 'dotenv'; // Secures content
|
||||
import cors from 'cors'; // HTTP headers
|
||||
// import IMPORTED_ROUTES from './routes/route.js';
|
||||
// import IMPORTED_ROUTES from './api/routes/route.js';
|
||||
// ^ ^ ^ un-comment this to use imported route(s)
|
||||
// doing this will link the following files: index.js -> route.js -> controller.js -> model.js
|
||||
|
||||
@@ -31,8 +31,8 @@ mongoose.connection.on('disconnected', () => console.log('❌ MongoDB disconnect
|
||||
// ^ ^ ^ uncomment this if you use the "unique: true" property in a Schema
|
||||
|
||||
// routes
|
||||
app.get('/example', (req, res) => res.send('Hello World - Express.js'));
|
||||
// app.use('/', IMPORTED_ROUTES);
|
||||
app.get('/', (req, res) => res.send('Hello World - Express.js'));
|
||||
// app.use('/api/v1/example', IMPORTED_ROUTES);
|
||||
// ^ ^ ^ un-comment this to use imported route(s)
|
||||
|
||||
// server is listening for requests
|
||||
|
||||
Reference in New Issue
Block a user