Skip to content

lavininhamelo/node-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions

1 - Create an .env file based on the .env.example file and inform the database URI (MongoDB)

  1. If you want to run the tests, configure the .env.test file with the test database URI

  2. Use yarn or npm install to install project dependencies

Commands to run

yarn start to start the server yarn test to run the tests

Documentation

It is possible to access the Swagger Documentation using the /api-docs route

Backend Challenge

The project is a simple challenge to test your skills in building APIs using the Node.js framework.

Submission

  • Read the description, requirements, and the others instructions

What to do

  • Create a simple API to manage the system of posts (CRUD).

This API should allow to:

Method Name Route
POST Create Post /api/posts
GET Listing Posts /api/posts
GET Get Post By ID /api/posts/:id
PUT Edit Post /api/posts/:id
DELETE Delete Post /api/posts/:id

The post must have the following fields:

Field Type
id UUID
title string
body string
tags string[]

Requirements

  • All API responses must be in JSON format.
  • Add pagination on the API for the listing of the posts
  • Provide the unit testing for all routes using Mocha and Chai or your preferred testing framework.
  • Provide documentation for all routes, we preferer using Swagger API, but you can using README for documentation.
  • Provide a README file with usage instructions (how to the runs, considerations, etc...).
  • Use naming written as camelCase by convention.

- The folders structures of the project should be following the example below.

├── src
│   ├── controllers
│   │   └── posts
│   ├── helpers
│   │   └── utils.js
│   ├── models
│   │   └── post.js
│   ├── routes
│   │   └── api
│   │       ├── posts.js
│   │       └── index.js
│   └── app.js
├── test
│   └── posts
├── .editorconfig
├── .gitignore
├── package.json
└── readme.md

Any routes should process the response in the controllers, no use function directly in the routes.

  • See example below

basic structure

Data Persistence

  • You will need to persist the data in some way, maybe in memory.
  • You don't need to use any external data persistence (database, cache, etc.), and the easier it is for us to run it, is better.

Evaluation

  • Architecture
  • Automated tests
  • Functionalities of the APIs
  • Programming good practices
  • Project organization
  • Structure componentization
  • Clean code with camelcase pattern

Bonus Level Up

  • Authenticated the routes using JWT
  • Process and validate the data that the API receives before creating the post.
  • Using MongoDB for storage data
  • Using Swagger API documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages