node.js
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
node.js [2013/12/28 16:36] – [Installation] skipidar | node.js [2023/08/30 11:25] (current) – skipidar | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Node.js ===== | ||
+ | ==== Installation ==== | ||
+ | |||
+ | == Node.js Server == | ||
+ | At most follow this tutorial: https:// | ||
+ | |||
+ | - BUGS: **Foreman** is not found and **Bad file descriptor** error. Solutions: \\ http:// | ||
+ | |||
+ | |||
+ | == Hot Code-replacement == | ||
+ | When the server-code is changes, then the node.js app should be restarted. \\ | ||
+ | To achieve hot-code-replacement the node.js app should be run differently: | ||
+ | |||
+ | To install nodemon on server do | ||
+ | < | ||
+ | |||
+ | It then should be used as following to start a node.js application named " | ||
+ | < | ||
+ | |||
+ | |||
+ | |||
+ | ==== Heroku ==== | ||
+ | Heroku is the hosting, which is able to host node.js apps too! | ||
+ | |||
+ | The howto about deploying the app is here: https:// | ||
+ | |||
+ | === Heroku Addons === | ||
+ | |||
+ | Addons have to be explicetely enabled on Heroku. Possible addons are | ||
+ | * WebSockets | ||
+ | * MongoDB | ||
+ | |||
+ | |||
+ | == Enabling Websockets == | ||
+ | How to do that is described here: https:// | ||
+ | |||
+ | == Enabling MongoDb == | ||
+ | MongoDB is a NoSQL DB. | ||
+ | To use a free Plan from [[https:// | ||
+ | - create an account | ||
+ | - add your data to the url < | ||
+ | - use the library mongoskin as stated [[http:// | ||
+ | - Here is a short mongoskin syntax describtion: | ||
+ | // require mongoskin - the mongoDB library | ||
+ | var db = require(' | ||
+ | |||
+ | //insert some data | ||
+ | db.collection(' | ||
+ | if (err) throw err; | ||
+ | if (result) console.log(' | ||
+ | }); | ||
+ | |||
+ | // retrieve the collection named ' | ||
+ | db.collection(' | ||
+ | if (err) throw err; | ||
+ | console.log(result); | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== npx ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | |||
+ | Sometimes you might want to take a look at a specific package and try out some commands. But you cannot do that without installing the dependencies in your local node_modules folder. | ||
+ | |||
+ | That’s where npx comes in. | ||
+ | |||
+ | < | ||
+ | |||
+ | npx @pactflow/ | ||
+ | |||
+ | </ |