Getting Started
In the root directory of the project...
- Install node modules
yarn install
ornpm install
. - Start development server
yarn start
ornpm start
.
Next Steps
Sample Data
Replace the sample data stored in /server/sampleData.js. Replace the default images stored in /src/images.
Adding a New Page
- Create a folder in
/src/components
with your react components. - Add a route for your page to
/src/App.js
. - Add a button to the navigation bar in
/src/components/NavBar/index.js
.
Deployment
The generated templates can be deployed to Azure App Service using the following steps:
- In the root directory of the project
yarn build
ornpm build
to create a build folder. - Move the build folder inside the server folder.
- Deploy the server folder to Azure App Service using the Azure App Service Extension.
- If a database is used, add the environment variables defined in .env to your Application Settings.
- Consider adding authentication and securing back-end API's by following Azure App Service Security. Full documentation for deployment to Azure App Service can be found here: Deployment Docs.
File Structure
The front-end is based on create-react-app.
The back-end is based on Express Generator.
The front-end is served on http://localhost:3000/ and the back-end on http://localhost:3001/.
.
├── server/ - Express server that provides API routes and serves front-end
│ ├── routes/ - Handles API calls for routes
│ ├── app.js - Adds middleware to the express server
│ ├── sampleData.js - Contains all sample text data for generate pages
│ ├── constants.js - Defines the constants for the endpoints and port
│ └── server.js - Configures Port and HTTP Server
├── src - React front-end
│ ├── components - React components for each page
│ ├── App.jsx - React routing
│ └── index.jsx - React root component
└── README.md
Additional Documentation
-
React - https://reactjs.org/
-
React Router - https://reacttraining.com/react-router/
-
Bootstrap CSS - https://getbootstrap.com/
-
Express - https://expressjs.com/
This project was created using Microsoft Web Template Studio.