To initialize a nodejs project:
- run
npm init
, filled info, we will get apackage.json
file. - install some npm dependencied to make this nodejs server work, for example:
npm install express cors axios
express is a HTTP framework for running node servers.
cors make us be able to call this server from anywhere else on the internet.
axios make us be able to make API calls to chat engine.ionpm install --save-dev nodemon
to makenodemon
run our node server, modifyscripts
inpackage.json
file and add an attributestart
:"start": "nodemon index.js"
- write
index.js
file