newedenfaces-react | Character voting app for EVE Online
kandi X-RAY | newedenfaces-react Summary
kandi X-RAY | newedenfaces-react Summary
Character voting app for EVE Online
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Bundle all files
newedenfaces-react Key Features
newedenfaces-react Examples and Code Snippets
Community Discussions
Trending Discussions on newedenfaces-react
QUESTION
I'm very newbie to Node.js and so is this question.
Im using this example please take a look at this link below.
https://github.com/sahat/newedenfaces-react/blob/master/server.js
In this server.js file the programmer is making call to
mongoose.connect(config.database);
app.get('/api/characters', function(req, res, next) {}
etc
all in server.js file
I want to keep everything cleaner
and just do the
server.listen(app.get('port'), function() {}
on server.js
file and the rest of the things on some different file and import or stuff them.
Thanks.
...ANSWER
Answered 2017-Apr-09 at 15:34If you use the express cli generator (https://expressjs.com/en/starter/generator.html) to generate a project, you will see there how by default express separates api logic from the app.js (= your server.js file).
You have to declare in your app.js where specific logic for a controller is stored
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install newedenfaces-react
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page