Léo Salé 9e5fe602cf feat: send push notification on events 3 éve
..
api 9e5fe602cf feat: send push notification on events 3 éve
.gitignore 8bd7c6a11a feat: directions wrapper function 3 éve
README.md a3741d0a53 doc: serverless functions doc 3 éve
package-lock.json 9e5fe602cf feat: send push notification on events 3 éve
package.json 9e5fe602cf feat: send push notification on events 3 éve
tsconfig.json 8bd7c6a11a feat: directions wrapper function 3 éve

README.md

Serverless Functions

Backend for the mobile application.

How it works

By adding a file in the api folder, it will create an endpoint of the name of the file. For instance, the file directions-wrapper.ts is linked to the endpoint /api/directions-wrapper. When targeting the endpoint, the function defined in the related file will be executed.

To have a small example of a serveless function, check out directions-wrapper.ts

If you need to use secrets, define them as environment variables on the vercel site.

You have to run npm i each time the package.json is modified to install the new dependencies. It also includes each time you pull changes from others.

Login to Vercel

  1. Run npx vercel login
  2. Choose Email auth
  3. Email: teamprojectlodz@gmail.com
  4. Password: see teams

Test the functions

To locally test the functions, run npx vercel dev. It will start a local server that you can target for your tests.

Deploy new functions

Once authenticated, run npx vercel --prod

Deploy for the first time

For the first time, you have to link to the existing project.

  1. For Set up and deploy ..., answer y (default answer)
  2. For the scope, answer teamprojectlodz-gmailcom (default answer)
  3. For Link to existing project, answer y
  4. For the name of the existing project, answer physigo

It will generate a .vercel folder, which links to the project on vercel.