I have 2 separated site (static web and application). I've tried to use Express vhost middleware but I couldn't manage.
For the below codes I configured my hosts file as;
127.0.0.1 localhost
127.0.0.1 process.localhost
my server.js codes
var connect = require('connect')
var express = require('express')
var vhost = require('vhost')
var app = require('./app')
var static = require('./static')
var server = connect()
server
.use(vhost('localhost', static.service))
.use(vhost('process.localhost', app.service))
.listen(1337, function(){
console.log('Server is listening')
})
Then if I write my address bar localhost:1337 static page comes this is good. However, if I write process.localhost:1337 nothing comes.
What should I do?
Edit
If I add the below middleware to my codes when I write the address bar localhost:1337 console write localhost:1337 but is I write process.localhost:1337 console write nothing.
Actually problem was the change of hosts file permissions.
Solution is here; http://serverfault.com/a/452269/277517