In an ideal world, I'd split them up into multiple codebases but I'd like to have it on one single VPS (Digital Ocean droplet) so I can run multiple Node instances from one cheap server because I'm just experimenting with NodeJS for now. I'd like to stick to best practices within reason.Requirements:Single codebase so I can just boot up multiple Node scripts in same server.Currently, it will support a portfolio site/serving web requests ("client" module) and a blog running on Ghost ("blog" module).In future, I plan to put random REST API endpoints for random web apps/native apps on there (probably all into an "api" module, with possibility of breaking up large APIs into their own modules).Questions:Should I have multiple package.json and/or node_module dir? Or Keep it all in one and just pull what's needed in into the individual modules?How should structure my directories? Spent the last two hours reading about NodeJS architecture/project structure and came up with something like this:config/ blog.config.js client.config.js *.config.js blog/ (blog app code here) client/ (portfolio site and web frontend code here) api/ ... Am I missing common concepts/terms? Example, I saw mentions of "workers" in a RisingStack blog post. Is that what I'm creating within the "api" module to handle random API calls? Am I trying to setup a monorepo?I don't foresee much traffic but what are some important and not-so-important-but-good-to-know performance considerations?Are there other important things I'm not considering?
Submitted December 31, 2017 at 11:39PM by Xchai
No comments:
Post a Comment