To accelerate mobile page loading on mobile phone, we build the AMP app for Shuavayatra to show post page only in AMP format. This build with NodeJS.
The AMP app build using simple NodeJS without any framework. It's using Handlebar as templeting engine to render the view. The app working behind Nginx under amp.shuvayatra.org sub domain. So the request will not hit directly the app but it goes through NGINX.
- Clone the code from Github
https://github.com/Shuvayatra/amp-site.git shuvayatra-amp
- Switch to code directory and run
npm install
to install all packages needed by this app - We use PM2 process manager for Node App. Install pm2 NPM package globally to run node js app as a service
sudo npm install pm2 -g
- Run the Shuvayatra AMP app by call
pm2 start index.js --name amp
- You can check if the app already running by call
pm2 list
- Make sure your pm2 will run when the server start by running
sudo env PATH=$PATH:/usr/local/bin pm2 startup -u www-data
.