Surya Prakash Tumma
Surya Prakash Tumma

Reputation: 2193

How to integerate client(html,js,css) with node and run in a server

I have seen so many examples how node works and how node listens to the request.But I always in a confusion in how can we do a complete application with node at server side and run in a server.

Does anyone guide me how can i do a sample application with a login page (html )authenticates user at serverside(Node.js) and sends a response at client side.A complete flow to do a real time application.

Upvotes: 0

Views: 36

Answers (2)

Surya Prakash Tumma
Surya Prakash Tumma

Reputation: 2193

I found how to deply ext js app in Node.

1.build your Extjs app using sencha cmd

  1. copy the generated folder from build--> Productin folder

3.Paste the copied folder in Node server folder(dbview is my ext js app) enter image description here

  1. find the screenshot to know the files inside my dbview folder

enter image description here

  1. find my node server code in server.js file

            var express = require('express')
        var app = express()
    
        app.get('/', function (req, res) {
             res.sendFile(__dirname+"\\dbview\\index.html");
        })
        app.use(express.static(__dirname+"\\dbview"));
        var server = app.listen(3000, function () {
    
          var host = server.address().address
          var port = server.address().port
    
          console.log('Example app listening at http://%s:%s', host, port)
    
        })
    

After running my node server file using command node server.js,I am able to access my Application using http://localhost:3000/

Upvotes: 0

sctskw
sctskw

Reputation: 1598

I would checkout http://expressjs.com/starter/generator.html. This will generate a simple, fully working Node.JS Express application in an instant. Reading through this code will help you understand the basics of creating a web app with Node.

Upvotes: 1

Related Questions