![]() However, undefined is falsy meaning that it will evaluate to false. The if-condition leverages the fact that all JavaScript objects are truthy, meaning that they evaluate to true in a comparison operation. ![]() Since no data is attached to the response, we use the status method for setting the status and the end method for responding to the request without sending any data. We will answer the questions presented by the utility, and the result will be an automatically generated package.json file at the root of the project that contains information about the project.Ĭonst http = require ( 'http' ) let notes = [ ) Let's navigate to an appropriate directory, and create a new template for our application with the npm init command. In fact, npm originates from the Node ecosystem. We had already mentioned npm back in part 2, which is a tool used for managing JavaScript packages. Notice that the applications and exercises in this part are not all React applications, and we will not use the create -template react utility for initializing the project for this application. However, let's start with the basics by implementing a classic "hello world" application. Our goal is to implement a backend that will work with the notes application from part 2. The newest version of Node supports a large majority of the latest features of JavaScript, so we can use the latest features without having to transpile our code. The situation with JavaScript running in the backend is different. ![]() Please make sure that your version of Node is at least as new as the version used in the material (you can check the version by running node -v in the command line).Īs mentioned in part 1, browsers don't yet support the newest features of JavaScript, and that is why the code running in the browser must be transpiled with e.g. This course material was written with version v18.13.0 of Node.js. We will be building our backend on top of NodeJS, which is a JavaScript runtime based on Google's Chrome V8 JavaScript engine. In this part, our focus shifts towards the backend: that is, towards implementing functionality on the server side of the stack.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |