Когда я помещаю в адресную строку css, изображения работают, но мои файлы javascript не работают.
Например:
https://(. ..). Appspot.com/build/teste.css (работа) https://(. ..). appspot.com/build/teste.js (ошибка 404 - запрошенный URL /build/mycomponent.js не найден на этом сервере.)
Мой app.yaml:
runtime: nodejs10
handlers:
- url: /images
static_dir: static/images
expiration: '10s'
- url: /css
static_dir: static/css
expiration: '10s'
- url: /build
static_dir: static/build
expiration: '10s'
- url: /assets
static_dir: static/assets
expiration: '10s'
- url: /static
static_dir: static/.*
expiration: '10s'
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
Моя папка структуры:
/static
/css
/ *.css(work)
/images
/ *.png|jpg (work)
/assets
/ *.js (not work - 404 in log view)
/build
/ test.css (work)
/ test.js (not work - 404 in log view)
Мой файл index.ts:
import * as express from "express";
import * as fs from "fs";
import * as ejs from "ejs";
const VERSION : string = "1.0.6";
const PORT = Number(process.env.PORT) || 8080;
const app = express();
app.use(express.static('static'));
app.set("view engine", "html");
app.engine("html", ejs.renderFile);
app.set("views", __dirname + "/views");
app.use(function(req,res){
res.render("index");
});
app.listen(PORT, () => {
console.log(`Server version ${VERSION}`);
console.log(`App listening on port ${PORT}`);
});
PS: у satic_files те же проблемы. Я попробовал:
- url: /build/(.+)
static_files: static/build/\1
upload: static/build/(.*)
- url: /build/.*
static_dir: static/build