Careful, don't add your routes to config/packages/routing.yaml. That file contains the configuration of the routing package, not the definition of routes.
And run the server:
php -S 127.0.0.1:8080 -t public
Open in your browserhttp://localhost:8080/secret-agentTo verify that your Symfony installation is working before adding more pieces to it.
Webpack Encore
Let's install Encore and PhpExecJs
composer require webpack-encore
composer require nacmartin/phpexecjs
npm install
npm install --save left-pad
And write an encore config in webpack.config.ssr.js
1
2
3
4
5
6
7
var Encore =require("@symfony/webpack-encore");
Encore.setOutputPath("var/webpack/").setPublicPath("/").addEntry("server-bundle","./assets/js/app.js");
module.exports = Encore.getWebpackConfig();
Tip
You will see that there is already a webpack.config.js already. Don't touch it for now. It makes sense to have two different Webpack configurations for the JS code that will be run in your client and in your server.
And place the code we stole to the MI6 unto into assets/js/app.js