How did Single page application deploy?

  node.js, question
  • Since Single page application can realize end-to-end development before and after, how did it proceed when it was deployed? Is the front-end resource still placed under the static resource directory under the back-end framework as before?

  • Can the front end of Single page application really be deployed separately and independently?

  • Then, how is SEO conducted in Single page application? Before, I found that it was possible to render the page on nodejs. how did you do that? For example, how to use vuejs or angularjs or react frameworks?

  • Thank you!

No, you can go through the agent. such as

Nginx agent

Your static resources are~/static/Directory, and your backend service port is 8080, you can configure the following in nginx

# static file, request the static file agent to bring under the' static' directory
 location ~ ^/(images|javascript|js|css|flash|media|static)/ {
 root ~/static;
 bracket
 # Interface Proxy to api
 location ~ ^/(api)/ {
 root localhost:8080/api;
 bracket

1024, the landlord praised a safe life.

Node proxy

Node’s agent has a variety of options, I posted a gulp’s

var gulp = require('gulp');
 var connect = require('gulp-connect');
 var proxy = require('proxy-middleware');
 var url = require('url');
 gulp.task('connect', function () {
 connect.server({
 root: './',
 port: 3000,
 middleware: function (connect, opt) {
 var proxyOptions = url.parse('http://localhost:8080/api/');
 proxyOptions.route = '/api/';
 return [
 proxy(proxyOptions)
 bracket
 bracket
 })
 });

1024, the landlord praised a safe life.