Skip to content

Instantly share code, notes, and snippets.

@VingeB0
Last active March 28, 2018 15:37
Show Gist options
  • Save VingeB0/ff873915cffac80b569a8aac11b032c8 to your computer and use it in GitHub Desktop.
Save VingeB0/ff873915cffac80b569a8aac11b032c8 to your computer and use it in GitHub Desktop.
required - ansi,
http,
fs(readFile, readFileSync, writeFile, writeFileSync, appendFile, appendFileSync, (createWriteStream - write, end), createReadStream(on) ),
os,
events(emitter = new Emitter(), emitter.on, emitter.emit),
until(util.inherits(User, EventEmitter))
zlip
module - is a file and it have local variables
var x = 10 / var obj = require('./mod')
global.number = x
export.number = x
module.export = { var : num, syh : hello }
if (module.parent) { module.export = hello } else { hello() } - check module plug-in or executable
search modules
1. system module ('http')
2. root to the file system ('/dbconnection')
3. root to the file system ('./dbconnection') if not found load - json file, or if not - file.node
process.argv[0] //nodePath
process.argv[1] //appPath
process.argv[2] //arg 1
process.argv[3] //arg 2
node app.js 123 123
var http = require("http");
var message = "Hello Worw2d!";
http.createServer(function(request,response){
console.log(message);
response.end(message);
}).listen(3000, "127.0.0.1",()=>{
console.log("Сервер начал прослушивание запросов");
});
var express = require("express");
var app = express();
app.get("/", function(request, response){
response.end("Hello from Express!");
});
app.listen(3000);
{
"name": "node",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.3"
},
"devDependencies": {
"jasmine-node": "^1.14.5",
"nodemon": "^1.17.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment