Command | Description |
---|---|
npm install |
Installs all the dependencies in the package.json |
npm start |
Starts the server |
npm run start:dev |
Starts the server and watches for changes. Restarts on change |
npm run lint |
Lints JavaScript code making sure project remains consistent |
npm run open |
Mac only. Opens localhost:8000 in your default browser |
------------------------------- | ----------------------------------------------------------------------- |
- There are lots of useful Node modules and methods that will help you build your server.
fs
is one,fs.writeFile
andfs.readFile
will be useful as well. - Look at the Node.js documentation for a list of all the different modules, methods and how to use them. Of course, ask a mentor if you need pointing in the right direction!
- Take a look at the tests, and how they are structured. It may give you a hint on what your project should do.
-
You might want to refresh the page automatically when you submit a blog post. One way to do it is to send back to your client a 302 status code. A 302 status code basically says "redirect to whatever it says in the HTTP Location Header".
-
You might find the
response.writeHead()
method useful - read about it here. -
Find out more about status codes here. By the way, "status codes" and "response codes" mean the same thing :)
- The blog text box is a form field. The server will receive the form contents as a querystring. There is a core Node module called querystring that will help you cleanly extract the contents of your blog post. Find out about the core querystring module here.
- Http methods are your friend.
Stuck? Ask a mentor!
eslint - Lint tool
EditorConfig - Unifying the coding style for different Text Editors
node-static - Simple Node Routing Module
pre-commit - Learn about pre-commit hooks
istantbul - Istanbul is a JavaScript code coverage tool