This is a nodejs Backedn app with a REST API for a social app that can create todo list and posts . Users can also comment on posts.
- Nodejs
- Koa
- Prisma
- MongoDb
Make sure the mongo is started in replica mode follow this tutorial for it (https://docs.mongodb.com/manual/tutorial/deploy-replica-set/)[https://docs.mongodb.com/manual/tutorial/deploy-replica-set/] and make sure the mongo is running and the DATABASE_URL is passed to the .env file
- Clone the repository
- Run
npm install
to install all the dependencies - Run
npx prisma generate
to generate the prisma client - Run
npx prisma db push
to create the database - Run
npx prisma db seed
to seed the database - Run
npm run dev
to start the server in development mode - Run
npm run start
to start the server - Run
npm run test
to run the tests
URL:http://159.89.55.250:3000/public/register Method: POST Headers: [] Params: [] Body: {"type":"json","raw":"{ "name":"John Doe", "email":"hello@world.in", "password":"Hey@123" }"}
### API:/login URL:http://159.89.55.250:3000/public/login Method: POST Headers: [] Params: [] Body: {"type":"json","raw":"{ "email":"jd_1@gmail.com", "password":"1234567" }"}
### API:/posts URL:http://159.89.55.250:3000/posts Method: GET Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "name":"John Doe", "email":"hello@world.in", "password":"Hey@123" }"}
### API:/post/:ID URL:http://159.89.55.250:3000/post/641d6b00e6cb003a71c4d58b Method: GET Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "name":"John Doe", "email":"hello@world.in", "password":"Hey@123" }"}
### API:/posts URL:http://159.89.55.250:3000/posts Method: POST Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "title":"Post 1", "content":"Post 1 content" }"}
### API:/comment URL:http://159.89.55.250:3000/comment Method: POST Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "postId":"641d6b00e6cb003a71c4d58b", "comment":"Post 1 Comment" }"}
### API:/todos URL:http://159.89.55.250:3000/todos Method: GET Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "name":"John Doe", "email":"hello@world.in", "password":"Hey@123" }"}
### API:/todo/:ID URL:http://159.89.55.250:3000/todo/641d6d87976c02a19d952c7e Method: GET Headers: [{"name":"Authorization","value":""}] Params: []
### API:/user URL:http://159.89.55.250:3000/user/ Method: GET Headers: [{"name":"Authorization","value":""}] Params: []
### API:/todo/toggle/:ID URL:http://159.89.55.250:3000/todo/toggle/641d6d7b976c02a19d952c7d Method: PATCH Headers: [{"name":"Authorization","value":""}] Params: []
### API:todo URL:http://159.89.55.250:3000/todo Method: POST Headers: [{"name":"Authorization","value":""}] Params: [] Body: {"type":"json","raw":"{ "title":"Todo 1"
}"}