App for sharing file between devices using short urls.
The response from the API is formatted as:
{
status: fail | success
data?: any
error?: Error
}
Error {
name: string
message: string
}
In case of success the API will return a 200 HTTP Code along with the "ok" parameter defined as true. In case of error the HTTP code will be the one that best fit the situation, "ok" will be false and "data" will return an object with the error name and the message related to the error.
URL | Content-Type | Body (POST) | Success Response |
---|---|---|---|
GET /rooms/:id | - | - | Room |
POST /rooms | - | - | Room |
POST /files | multipart/form-data |
Keys: i) roomName: containing the room's name; ii) file: the file to be uploaded. | File |
DELETE /files/:id | - | - | - |
In order to notify all tabs with a specific room open about new uploaded files there's an instance of socket.io running. When a new file is sent to a room an event named "newFile" is broadcasted to the socket's room with the same name of the room, the payload of that message is:
{
roomName: string
file: File
}
Room {
name: string
status: string
usedSpace: number
maxSpace: number
files: File[]
createdAt: Date
expiresOn: Date
}
File {
name: string
location: string
size: number
mimetype: string
hash: string
}
roomNotFound
fileMissing
invalidRoom
- Node.js
- MongoDB
- AWS Account
git clone https://github.com/dygufa/memuy_api.git
cd memuy_api
yarn
In order to run this webserver you need to define the .env
file using the .env.example
:
cp .env.example .env
nano .env
yarn dev
will start a express webserver (mpmv.js) using nodemon and a tsc --watch instance to auto compile on file change. The port can be defined on the.env
file.
- Sentry
- Unit test