Skip to content

rajeshm20/StudentAppBackend

Repository files navigation

StudentAppBackend

💧 A project built with the Vapor swift server framework.

Getting Started

To build the project using the Swift Package Manager, run the following command in the terminal from the root of the project:

swift build

To run the project and start the server, use the following command:

swift run

To execute tests, use the following command:

swift test

See more

After

docker pull ghcr.io/rajeshm20/studentappbackend:latest

pulling 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:

  1. Install MySQL

Update Homebrew: First, make sure Homebrew is up to date by running the following command in your terminal:

brew update

Install MySQL: Next, install MySQL using the brew install command:

brew install mysql

This will download and install the latest stable version of MySQL.

  1. 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 mysql

Start it manually each time you want to use it:

mysql.server start

You 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_installation

You'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.

  1. 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 3306

The -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"

About

vapor swift server sample student app backend with signup and login services. jwt, middleware, https enabled

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages