Skip to main content

Posts

Call functions in Node.js

 We are creating two files "Servers.js" and another one is "index.js". These two files are available in a folder "Twofiles". Below are some code that will help you to write your own server.   Servers.js ------------- var http = require("http"); function start() { function onRequest(request, response) { console.log("Request received."); response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello Worldfdsfadfds"); response.end(); } http.createServer(onRequest).listen(8888); console.log("Server has started."); } exports.start = start; =============================================================== index.js ------------------- var server = require("./Servers"); server.start() ==============================================================
Recent posts

What is Cucumber , It's working structure?

1. Cucumber is a high-Level Testing framework that supports behavior driven development. 2. It runs automated acceptance tests on web applications. 3. A Cucumber is a tool that executes plain-text functional descriptions as automated tests.      The language that Cucumber understands is called Gherkin. Cucumber Working structure:- Features Introduction:- Every .feature file conventionally consists of a single feature. A line starting with the keyword  Feature following by free indented text stars a feature. A feature usually contains a list of scenarios. Scenarios together independent fo your file and directory structure. Example:- 1) Given: - The login page is opening ( what software will look like to user) 2)  When: - I input username and password and click the login button.(Things that the user will do) 3) Then: - I am on the home page 9 what the user should expect)