Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsnomad/adonisjs-create-react-app
Adonisjs + Create React App Boilerplate
https://github.com/jsnomad/adonisjs-create-react-app
adonis adonisjs api create-react-app nodejs react reactjs spa
Last synced: 2 months ago
JSON representation
Adonisjs + Create React App Boilerplate
- Host: GitHub
- URL: https://github.com/jsnomad/adonisjs-create-react-app
- Owner: jsnomad
- License: mit
- Created: 2019-01-07T17:05:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T03:08:55.000Z (about 2 years ago)
- Last Synced: 2023-04-30T20:32:44.824Z (over 1 year ago)
- Topics: adonis, adonisjs, api, create-react-app, nodejs, react, reactjs, spa
- Language: JavaScript
- Homepage:
- Size: 1.46 MB
- Stars: 22
- Watchers: 2
- Forks: 6
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# adonisjs-create-react-app
Boilerplate/Starter Project for building APIs using [Adonisjs](https://github.com/adonisjs/adonis-framework), with a React frontend using [Create React App](https://github.com/facebook/create-react-app).
# Setup
Install AdonisJs CLI globally :
npm i -g @adonisjs/cli
Then create the project :
adonis new --blueprint=jsnomad/adonisjs-create-react-app
Alternatively you can clone the project and install dependencies manually :
git clone https://github.com/jsnomad/adonisjs-create-react-app.git
npm installInstall React dependencies :
cd front
npm install# Start
Run the following command to start the HTTP server :
adonis serve --dev
Runs the React app in development mode :
cd front
npm startThen you can access to the React App using :
http://localhost:3000/
### Make API request
fetch('/api/v1/***')
In development, the React development server will recognize that it’s not a static asset, and will proxy your request to `http://localhost:3333/api/v1/***` as a fallback.
# Production
Create a React production build :
cd front
npm run buildThe build folder will be automatically moved in the Adonisjs public folder.
Then start the HTTP server using a process manager like pm2 (recommended) :
pm2 start server.js
For better performance, consider using nginx as a reverse proxy (faster to server static assets).