An API to generate Agora.io
video call token and register users and schedules.
This Api can be used in two different ways: by cloning the project or by using your preferred client, such as Insomnia or Postman.
First of all configure an .env
file following the .env.example
To clone the project, run the following command:
git clone https://github.com/kirodoras/see-me-back
Then, navigate to the project folder and run the following command:
to install dependencies:
npm i -y
to migrate the database:
npm run migrate
Finally, start the server:
npm run dev
You can now access the API's endpoints by navigating to http://localhost:5008/
or to the deployed URL https://app-see-me.herokuapp.com/
.
After following the Getting Started steps, follow the commands:
First of all configure an .env.test
file
to migrate the test database:
npm run test:migrate
Finally, run the integration tests:
npm run test
or run the unit tests:
npm run test:unit
Token /token
Users /users
Schedules /schedules
- Create a schedule
/create
- Find schedules by user id
/findByUserId
- Delete schedule by id
/delete/:id
GET /token?channelName={NAME}
- headers: {}
- body: {}
RESPONSE IN SUCCESS
- status: 200
- data: {
token: AGORA.IO CHANNEL TOKEN
}
POST users/login
- headers: {}
- body: {
email: "hulk@email.com",
name: "Bruce Banner",
picture: "https://picture.url..."
}
RESPONSE IN SUCCESS
- status: 201
- data: {
email: "hulk@email.com",
name: "Bruce Banner",
picture: "https://picture.url...",
token: JWT TOKEN
}
POST users/find
- headers: {}
- body: {
email: "hulk@test.com",
}
RESPONSE IN SUCCESS
- status: 200
- data: {
email: "hulk@email.com",
name: "Bruce Banner",
picture: "https://picture.url...",
token: JWT TOKEN
}
POST /schedules/create
- headers: {
"Authorization": Bearer [JWT-TOKEN]
}
- body: {
title: "My title",
hours: "12:12"
}
RESPONSE IN SUCCESS
- status: 201
- data: {
id: 6,
title: "My title",
hours: "12:12",
user_id: 2
}
GET /schedules/findByUserId
- headers: {
"Authorization": Bearer [JWT-TOKEN]
}
- body: {}
RESPONSE IN SUCCESS
- status: 200
- data: Object[] of schedules
GET /schedules/delete/:id
- headers: {
"Authorization": Bearer [JWT-TOKEN]
}
- body: {}
RESPONSE IN SUCCESS
- status: 200