💧 A project built with the Vapor swift server framework.
To build the project using the Swift Package Manager, run the following command in the terminal from the root of the project:
swift buildTo run the project and start the server, use the following command:
swift runTo execute tests, use the following command:
swift testAfter
docker pull ghcr.io/rajeshm20/studentappbackend:latestpulling the docker image and successfully running that includes StudentAppBackend app and mysql, try below endpoints using curl with http
SignUp
curl -k -X POST https://localhost:8080/auth/signup \
-H "Content-Type: application/json" \
-d '{"name":"SasvathRN", "email": "sasvathrn@rnss.com", "password":"password123"}'
Login
curl -k -X POST https://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "rajesh@example.com",
"password": "password123"
}'
with https Signup
curl https://localhost:8080/auth/signup \
-H "Content-Type: application/json" \
-d '{"name":"SasvathRN", "email": "sasvathrn@rnss.com", "password":"password123"}'Login
curl https://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"sasvathrn@rnss.com","password":"password123"}'Installing and configuring MySQL on a Mac using Homebrew is a straightforward process. Here's a step-by-step guide:
- Install MySQL
Update Homebrew: First, make sure Homebrew is up to date by running the following command in your terminal:
brew updateInstall MySQL: Next, install MySQL using the brew install command:
brew install mysqlThis will download and install the latest stable version of MySQL.
- Configure MySQL
After the installation is complete, you'll need to start and secure your MySQL server.
Start the MySQL Service: You can start the MySQL server as a background service. There are a couple of ways to do this:
Start it immediately and have it launch at startup:
brew services start mysqlStart it manually each time you want to use it:
mysql.server startYou can check the status of the service at any time with brew services list.
Secure the Installation: It's crucial to run the security script to set a root password, remove anonymous users, and disable remote root login. Run the following command:
mysql_secure_installationYou'll be prompted to follow a series of steps:
Validate Password Component: You can choose to enable or disable this. It enforces strong password policies.
Set the root password: This is a critical step. Choose a strong password.
Remove anonymous users: Type Y to remove them.
Disallow root login remotely: Type Y to prevent remote access for the root user.
Remove test database: Type Y to remove the default 'test' database.
Reload privilege tables: Type Y to apply all the changes.
- Connect to MySQL
Once MySQL is installed and configured, you can connect to it from your terminal.
Connect to the MySQL server: Use the following command and enter the root password you set during the security configuration.
mysql -u root -p -h 127.0.0.1 -P 3306The -u flag specifies the user (root), and the -p flag prompts for the password.
Verify the connection: If successful, you'll see the MySQL prompt, where you can start executing SQL commands. To exit, type exit; and press Enter.
To Enable https You need to re-generate the cert with CN=localhost:
openssl req -x509 -newkey rsa:2048 -nodes
-keyout key.pem -out cert.pem -days 365
-subj "/CN=localhost"
Then rebuild the .p12:
openssl pkcs12 -export -out localhost.p12
-inkey key.pem -in cert.pem
-name "Vapor Localhost Cert"