You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
5 years ago | |
|---|---|---|
| app | 5 years ago | |
| bootstrap | 5 years ago | |
| config | 5 years ago | |
| database | 5 years ago | |
| public | 5 years ago | |
| resources | 5 years ago | |
| routes | 5 years ago | |
| storage | 5 years ago | |
| tests | 5 years ago | |
| .editorconfig | 5 years ago | |
| .env.example | 5 years ago | |
| .gitattributes | 5 years ago | |
| .gitignore | 5 years ago | |
| .styleci.yml | 5 years ago | |
| README.md | 5 years ago | |
| README_LARAVEL.md | 5 years ago | |
| artisan | 5 years ago | |
| composer.json | 5 years ago | |
| composer.lock | 5 years ago | |
| package-lock.json | 5 years ago | |
| package.json | 5 years ago | |
| phpunit.xml | 5 years ago | |
| server.php | 5 years ago | |
| webpack.mix.js | 5 years ago | |
README.md
Steps to Create and Deploy
Initialize
-
Make sure you have MAMP and Postgres installed and running
-
Download comopser: https://getcomposer.org/composer-stable.phar
-
In Terminal, run:
mv ~/Downloads/composer-stable.phar /usr/local/bin/composerchmod 755 /usr/local/bin/composercomposer global require laravel/installerecho 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bash_profilels /Applications/MAMP/bin/phpand take note of the most recent version- run
echo 'export PATH="/Applications/MAMP/bin/php/php7.4.2/bin:$PATH"' >> ~/.bash_profilesubstituting your latest version of php forphp7.4.2
-
close terminal window and open a new one
-
go to where you want your app to be and run
laravel new blogsubstituting the name of your app forblog -
cdinto your app's dir -
run
php artisan serve -
go to http://localhost:8000/
Connect to db
Connect to psql and
CREATE DATABASE contacts;
\c contacts
CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
INSERT INTO people (name, age) VALUES ('matt', 40);
In .env file, adjust the following:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
so it is:
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=contacts
DB_USERNAME=matthuntington
DB_PASSWORD=
Create routes
In routes/api.php add:
Route::get('people', function () {
$users = DB::select('SELECT * FROM people');
return $users;
});