A Node.js + Express + MongoDB API for managing creator cards.
Built using the Resilience17 backend template.
https://node-assessment-433q.onrender.com| Method | Endpoint | Description |
|---|---|---|
| POST | /creator-cards |
Create a creator card |
| GET | /creator-cards/:slug |
Get a creator card |
| DELETE | /creator-cards/:slug |
Soft delete a creator card |
models/creator-card.js
repository/creator-card/index.js
messages/creator-card.js
services/creator-cards/
endpoints/creator-cards/Clone the repository:
git clone https://github.com/kemsguy7/node-assessment.git
cd node-assessmentInstall dependencies:
npm installCreate environment file:
cp .env.example .envAdd:
PORT=3000
MONGODB_URI=your_mongodb_atlas_uri
APP_BASE_URL=http://localhost:3000
APP_NAME=creator-card-api
PINO_LOG_LEVEL=infoRun locally:
npm run devServer runs on:
http://localhost:3000Local:
curl -X POST http://localhost:3000/creator-cards \
-H "Content-Type: application/json" \
-d '{
"title":"George Cooks",
"slug":"george-cooks",
"creator_reference":"crt_8f2k1m9x4p7w3q5z",
"status":"published"
}'Production:
curl -X POST https://node-assessment-433q.onrender.com/creator-cards \
-H "Content-Type: application/json" \
-d '{
"title":"George Cooks",
"slug":"george-cooks",
"creator_reference":"crt_8f2k1m9x4p7w3q5z",
"status":"published"
}'Local:
curl http://localhost:3000/creator-cards/george-cooksProduction:
curl https://node-assessment-433q.onrender.com/creator-cards/george-cooksLocal:
curl -X DELETE http://localhost:3000/creator-cards/george-cooks \
-H "Content-Type: application/json" \
-d '{
"creator_reference":"crt_8f2k1m9x4p7w3q5z"
}'Production:
curl -X DELETE https://node-assessment-433q.onrender.com/creator-cards/george-cooks \
-H "Content-Type: application/json" \
-d '{
"creator_reference":"crt_8f2k1m9x4p7w3q5z"
}'Build command:
npm installStart command:
npm startEnvironment variables:
MONGODB_URI=your_mongodb_atlas_uri
APP_NAME=creator-card-api
PINO_LOG_LEVEL=infoCreate app:
heroku create creator-card-apiSet config:
heroku config:set MONGODB_URI=your_mongodb_atlas_uri
heroku config:set APP_NAME=creator-card-api
heroku config:set PINO_LOG_LEVEL=infoDeploy:
git push heroku main- VSL validation
- Slug auto-generation
- Slug uniqueness check
- Public/private access control
- Soft delete support
- Error code mappings
- API responses use
idinstead of_id