When I put into addressbar the css, images work but my javascript files not work.
Eg:
https://(...).appspot.com/build/teste.css (work) https://(...).appspot.com/build/teste.js (404 error - The requested URL /build/mycomponent.js was not found on this server.)
My 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
My structury folder is:
/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)
My index.ts file is:
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 have the same problems. I tried :
- url: /build/(.+)
static_files: static/build/\1
upload: static/build/(.*)
- url: /build/.*
static_dir: static/build