Giter Site home page Giter Site logo

node-js-express-http-server's Introduction

Overview

A sample node js express http server which exposes REST methods like GET, POST, DELETE in a HTTP port

Install Node.js

Install Node.js from https://nodejs.org/en/download/ I have installed it using Windows Installer (.msi) 64-bit (https://nodejs.org/dist/v6.10.0/node-v6.10.0-x64.msi) for my windows desktop

Open Node.js command prompt

Open Node.js command prompt so that it picks up the node executable start(windows) --> All Programs --> Node.js --> Node.js command prompt

Checkout project from Github

You probably might be aware of Github, so you can ignore and goto next step but if you are new to github, To go to your workspace and checkout the project from github $ cd C:\workspace
$ git clone https://github.com/devarajanv/node-js-express-http-server.git

Install Express for http methods

$npm install express --save

Edit/Run the javascript

Edit/Run the javascript file(http-server.js). This creates a JSON document, inserts it into MarkLogic Database(Documents Database) by making a REST API interface call. $ node http-server.js

Output

Example app listening at http://:::8082 To Verify this output, please make a REST call in your browser or any REST Client(Like Postman, SoapUI) and goto

GET http://localhost:8082/

Output will be 200 Success response code with this message below: Hello GET

FAQ or Frequently faced errors

If you have run this command $node http-server.js ahead of installing dependencies for node.js, then you'll get this error. Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (C:\workspace\node-js-express-http-server\http-server.js:4:15) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3)

node-js-express-http-server's People

Contributors

devarajanv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.