I use refify building apis, it works great. But I need to display some web pages in one application.
Is it possible that I can use express and regenerate together in one application?
this is the code to restore the server in app.js
var restify = require('restify'); var mongoose = require('mongoose'); var server = restify.createServer({ name : "api_app" }); server.use(restify.queryParser()); server.use(restify.bodyParser()); server.use(restify.CORS()); mongoose.connect('mongodb://localhost/db_name'); server.get('/', routes.index); server.post('/api_name', api.api_name); server.listen(8000 ,"localhost", function(){ console.log('%s listening at %s ', server.name , server.url); });
How to create an express server in the same app.js application?
thanks
wwli
source share