Laravel backend for co2app. The used template is directly from the Laravel Docs.
- Clone this repo
- Copy .env.example to
.env
- Run
./vendor/bin/sail up
let that terminal run in the background - In a second terminal run
./vendor/bin/sail php artisan key:generate
- Run
./vendor/bin/sail php artisan migrate
You can use sail
for all Laravel commands e.g. ./vendor/bin/sail php artisan migrate
.
Use the following commands to get a working CO2 Backend on your machine:
- Terminal:
./vendor/bin/sail up
- Terminal
./vendor/bin/sail php artisan migrate
Set APP_ENV
in .env from production
to local
. Then run:
- Terminal:
./vendor/bin/sail up
- Terminal
./vendor/bin/sail php artisan migrate
npm install
npm run dev
The path in the app.blade file will automatically use vite on port 3000.
File | Description |
---|---|
migration | The migration file of the database structure. |
model | The CO2 app data model. |
controller | The controller that responds to the api requests. |
routes | API routes definition. All routes will be available under /api . |
Send a JSON POST
request with the co2 app data to http://localhost/api/co2data
. Don't forget to set accept: application/json
in the header to get a proper validation failed response instead of a redirect.
Look at the data validator if you encounter problems.