Understanding GET, POST & UPDATE using Vapor
Getting started with Vapor
A small project to understand the basic concepts of Vapor.
Run Command on Terminal
- To create a new project
$dev vapor new project_name -n
$dev vapor --help
- To create a new project with Fluent
$dev vapor new project_name
$dev Would you like to use Fluent? (--fluent/--no-fluent) <y/n> y
$dev fluent: Yes
$dev db: Postgres (Recommended)
$dev Would you like to use Leaf? (--leaf/--no-leaf)
$dev y/n> n
$dev leaf: No
- Install Brew (if you don’t have it)
refer to this link to install: https://brew.sh/
- To enable/disble services for Postgres
$dev brew services start postgresql
$dev brew services stop postgresql
$dev brew services restart postgresql
- Create a DB via Postgres assuming user name as todo_user and database name as todo_db
$dev createuser -P todo_user
$dev createdb -O todo_user todo_db
- Open the package assuming user name as todo_user and database name as todo_db
$dev cd project_name
$dev open Package.swift
- To check the active routes
$dev vapor run routes
- To migrate the database
$dev vapor run migrate