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

Modularisation #17

Open
danilo-cupido opened this issue Oct 1, 2021 · 0 comments
Open

Modularisation #17

danilo-cupido opened this issue Oct 1, 2021 · 0 comments

Comments

@danilo-cupido
Copy link

It's a good practice to divide code by features:

fritter/server.js

Lines 61 to 70 in fb80839

server.post('/', bodyParser, (request, response) => {
// Collects new frit message
const newFritMessage = request.body.message;
const newFritName = request.body.name;
const newFrit = {
user: newFritName || 'annonymouse 🐭',
message: newFritMessage,
time: new Date(),
};

The request/response part of the code above could be a separate function in a dedicated routes folder. 🧐💝

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

No branches or pull requests

1 participant