Running Rails server
In the previous chapter we had set up a basic Rails server. There we ran the
Rails server from the terminal using the
bundle exec rails server -p 3000
We can also use an alias, that is
server, in the above mentioned
command to run a Rails server in the shortened format, like so:
1bundle exec rails s -p 3000
p flag is used to specify the
PORT number on which the server will run.
In this case the PORT number is 3000.
Thus we should compile Webpack related files separately.
Using Webpack development server
Before moving further ensure that you've set your
webpack-dev-server versions as mentioned in
We will run the
rails server command in one terminal and the
webpack-dev-server command in another terminal.
Open a new terminal tab or window. In the "Terminal" app in macOS you can do so
command + T keys for a new tab and
command + N keys for a new terminal
Once a new terminal is open, run the following command:
webpack-dev-server is an executable file which resides inside the
folder. Running the above command will start the Webpack development server and
Webpacker will automatically proxy all Webpack asset requests to this server.
Running the application
So to summarize, whenever testing out a Rails application in development
environment, open the Rails server in one terminal and
another. Thus when stopping the application, you will have to exit from both
If you're still not convinced on the advantages of using
then give the last two
within the book a read and come back. Those sections might be pretty
complicated. That's why it's towards the end of the book. There's no issue if
you don't read it now.
There is nothing to be committed in this chapter.