Tuesday, April 11, 2017
In the previous blog we setup the folder structure to use the Jade view engine just to make sure Express is working correctly. In this blog post we are going to tell Express to serve file static files as well in our app folder. In the previous part when we browse to http://localhost:3000 we get the "Express" index page. Using a view engine is a preference that some people have, but I feel more comfortable developing in HTML.
In this blog post we are going to get back our index page that says "My Bank Application"
Here are the steps to serve up static files in Express:
1. Open up the express app.js file with an IDE or text editor
2. You will see the line app.use(express.static(path.join(__dirname, 'public'))); , change it to app.use(express.static(path.join(__dirname, 'app'))); what we did was telling express to use the folder app for static files instead of the public folder. With this setup you can always go back and use the Jade view engine if you choose to. We haven't taken take option off the table.
3. Now open the command prompt and type nodemon into to command prompt, open the browser and type into the address bar http://localhost:3000 you should see "My Bank Application" now we are back in business
Posts In The AngularJS SPA Application Series:
In this blog post we are going to get back our index page that says "My Bank Application"
Here are the steps to serve up static files in Express:
1. Open up the express app.js file with an IDE or text editor
2. You will see the line app.use(express.static(path.join(__dirname, 'public'))); , change it to app.use(express.static(path.join(__dirname, 'app'))); what we did was telling express to use the folder app for static files instead of the public folder. With this setup you can always go back and use the Jade view engine if you choose to. We haven't taken take option off the table.
3. Now open the command prompt and type nodemon into to command prompt, open the browser and type into the address bar http://localhost:3000 you should see "My Bank Application" now we are back in business
Posts In The AngularJS SPA Application Series:
- Setting Up Angular-Seed
- Preparing Angular-Seed For The Shopping List Application
- Refactor Code to Not Use Global Variables (Shopping List App)
- Installing MongoDB
- Create a MongoDB Configuration FIle
- Install mongoDB as a Windows Service
- Installing Express generator
- Installing ExpressJS Application Server
- Creating The SPA Project Folder Structure
- Setup Express To Serve Static Files
- Setup The Shopping Application For Heroku And Testing It Locally
- Deploy Shopping List Application To Heroku
- Install RoboMongo GUI for MongoDB
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
Mua vé tại đại lý vé máy bay Aivivu, tham khảo
ReplyDeleteve may bay di my gia re
có chuyến bay từ mỹ về việt nam chưa
mua vé máy bay từ đức về việt nam
giá vé máy bay nga về việt nam
ve may bay tu anh ve viet nam
lịch bay từ pháp về việt nam
chi phí vé máy bay cho chuyên gia nước ngoài