-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor files and folder - SRP. #1
base: master
Are you sure you want to change the base?
Conversation
Single responsibility principle
const Server = http.createServer((req, res) => { | ||
if(req.url === '/api/products' && req.method === 'GET') { | ||
getProducts(req, res) | ||
} else if(req.url.match(/\/api\/products\/([0-9]+)/) && req.method === 'GET') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@@ -1,7 +1,7 @@ | |||
let products = require('../data/products') | |||
const { v4: uuidv4 } = require('uuid') | |||
|
|||
const { writeDataToFile } = require('../utils') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
const { getProducts, getProduct, createProduct, updateProduct, deleteProduct } = require('./controllers/productController') | ||
const { getProducts, getProduct, createProduct, updateProduct, deleteProduct } = require('./app/controllers/productController') | ||
const Server= require('./app/app') | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
|
||
server.listen(PORT, () => console.log(`Server running on port ${PORT}`)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
server.js
create app.js
and app folder
Single responsibility principle