Node.js WTF??????????????????
- Node.js is an open-source framework
- Node.js is a cross-platform runtime environment for developing server-side and networking applications
- Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
- Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
Installing Node.js to get started
Check with Everything
- To get started with Node.js, let's try it in the terminal! Start Node.js by simply typing
node
:
$ node
>
Okay, let's try printing something:
$ node
> console.log('hello from Node.js')
Once you hit Enter
, you will get something like this:
> console.log('hello from Node.js')
hello from Node.js
undefined
When Starting a new Project
- Every Node.js project starts with creating a package.json file - you can think of it as a JSON representation of the application and its' dependencies. It contains your application's name, the author (you), and all the dependencies that is needed to run the application
- Command to create this file is npm init and follow the instructions.
- It will create something like this
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "",
"license": "ISC"
}
No comments:
Post a Comment