Search code examples
node.jssubmission

Node.js coding challenge - what files to submit


I'm doing a coding challenge in node where I need to submit the answer as a .zip file. Which files do I need to submit? The files in my folder are:

  1. server.js (main file)
  2. package.json
  3. package-lock.json
  4. node-modules (folder)

I have not started the challenge yet because there is a time limit, so I don't know if further details will be provided in the problem description. So, in general, what files do I need to submit and how does the person know that my solution is writtien in Node?


Solution

  • Of course you need to refer to what your challenge says, but in terms of what a baseline Node project should consist of — which I think is what you're really asking here — you just need your js source files and package.json.

    If you have a .js Node file like your server.js and a package.json, it can be run with the following commands:

    $ npm install

    $ node server.js

    Your package.json file should include a "main" item which specifies server.js as the project's launch file, or whatever file you want it to launch from.

    package-lock.js can also be included, as it will lock down your dependencies exactly. node_modules is not necessary to include because package.json and package-lock.json will be used to generate node_modules.

    There's nothing else that a Node project must have included, although a README.md file is good practice to have as well. You could also specify in the README that this is a Node project and add the commands required to run it, which would be good to do if your challenge does not directly specify that all projects should be in Node.