- MongoDB
- If using .env.template, local instance of
mongod
running
npm install
npm start
GET /api/timestamp
curl -i -H 'Accept: application/json' http://localhost:3000/api/timestamp/2023-06-23
200 OK
{
"unix": 1687478400000,
"utc": "Fri, 23 Jun 2023 00:00:00 GMT"
}
GET /api/whoami
curl -i -H 'Accept: application/json' http://localhost:3000/api/whoami
200 OK
{
"ipaddress": "your ip address",
"language": "en-US,en;q=0.5",
"software": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0"
}
Must be a document present in database
GET /api/url-shortener/:shortUrl
curl -i -H 'Accept: application/json' http://localhost:3000/api/url-shortener/1
200 OK
{
"originalUrl": "dev.to",
"shortUrl": 1
}
POST /api/url-shortener
curl -X POST http://localhost:3000/api/url-shortener
-H 'Content-Type: application/json'
-d '{"url": "dev.to" }'
200 OK
{
"originalUrl": "dev.to",
"shortUrl": 1
}
POST /api/file-metadata
curl -F 'file=@/home/path/to/a/folder/fry-example.jpg' http://localhost:3000/api/file-metadata
{
"name": "fry-test.jpg",
"type": "image/jpeg",
"size": 640254
}