This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const _fs= require('fs'); | |
| let _contents = _fs.readFileSync('package.json').toString(); | |
| console.log(_contents); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const _fs = require('fs'); | |
| _fs.readFile('package.json', function (_err, _buf){ | |
| console.log(_buf.toString()); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http = require('http'); | |
| const hostname = '127.0.0.1'; | |
| const port = 3000; | |
| const server = http.createServer((req, res) => { | |
| res.statusCode = 200; | |
| res.setHeader('Content-Type', 'text/plain'); | |
| res.end('Hello World\n'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http = require('http'); | |
| const server = http.createServer((req, res) => { | |
| res.writeHead(200); | |
| res.end('Hurray! you have caught your 1st pokemon'); | |
| }); | |
| server.listen(3020, ()=>{ | |
| console.log('the server is running on http://localhost:3020'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http = require('http'); | |
| const server = http.createServer((req, res) => { | |
| res.writeHead(200, {'content-type':'text/html'}); | |
| res.end('<p><strong>Hurray!</strong> you have caught your 1st pokemon.</p>'); | |
| }); | |
| server.listen(3020, ()=>{ | |
| console.log('the server is running on http://localhost:3020'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'), | |
| app = express(); | |
| app.get('/',(request,response)=>{ | |
| response.send('Go-catcha Express!'); | |
| }); | |
| app.listen(3020,()=>console.log('node.js express server started at port 3020')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const app = require('express')(); | |
| const path = require('path'); | |
| //setting our app engine to handlebars | |
| app.set('views', path.join(__dirname,'views')) | |
| app.set('view engine', 'hbs'); | |
| app.get('/',(request,response)=>{ | |
| response.render('index'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const app = require('express')(); | |
| const path = require('path'); | |
| //setting our app engine to handlebars | |
| app.set('views', path.join(__dirname,'views')); | |
| app.set('view engine', 'hbs'); | |
| app.get('/',(request,response)=>{ | |
| let _pokemonList = getRandomPokemonList(); | |
| response.render('index',{pokemon:_pokemonList}); |
OlderNewer