目前我正在使用express.js处理Web应用程序.我想要一个前端和后端.前端应该显示来自数据库的一些内容,在后端我想创建这个内容(类似于cms).
我从这个文件夹结构开始:
app/
??? frontend/
? ??? public //Javascript, css & images only for frontend
? ??? views //Frontend jade templates
? ??? client.js
?
??? backend/
? ??? public //Only backend css & stuff
? ??? views //Backend templates
? ??? core.js
?
??? server.js //Starts the whole application
Run Code Online (Sandbox Code Playgroud)
server.js
var express = require('express');
var app = express();
var config = require('../app/config.json')[app.get('env')];
var backend = require('./backend/core');
var frontend = require('./frontend/client');
app.use(backend);
app.use(frontend);
app.set('port', config.port || 3000);
var server = …Run Code Online (Sandbox Code Playgroud)