Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rogergcc
Copy link

server.js
create app.js
and app folder
Single responsibility principle

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') {

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')

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')


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}`))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants