Answer the question
In order to leave comments, you need to log in
How to split a nodejs application into components?
Good afternoon, I'm writing a server for a NodeJS game and I ran into such a problem: I want to split my application into components, such as: registration, authorization, etc.
I started like this:
index.js
const express = require('express')
const app = express()
app.listen(3000, () => { console.log('server successfully started') })
module.exports = app
const app = require('../../index.js')
app.post('/auth', (req, res) => {
res.end('request has been handled')
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question