Code challenge. Let's do it!
npm i
to install dependencies.
npm run start
to build and run the simplest example (included in root directory as input.txt
).
npm run check --in=inpat.txt --out=outpat.txt
to provide a custom input and output files.
Run docker run -dp 8080:8080 marcosaurios/martian-robots:prod
to expose API over desired port.
On heroku is available through https://marcosaurios-martian-robots.herokuapp.com/ Docker repo: https://hub.docker.com/repository/docker/marcosaurios/martian-robots
Request data should be in FormData format. Example:
var formdata = new FormData(); formdata.append("file", fileInput.files[0], "input.txt"); var requestOptions = { method: 'POST', body: formdata, redirect: 'follow' }; fetch("https://marcosaurios-martian-robots.herokuapp.com/explore", requestOptions) .then(response => response.text())
Type | Route | Request | Response |
---|---|---|---|
POST | /explore | body: { file: input.txt } |
1 1 E |
- Typescript: for type checking, ensuring every piece of code fits well each other.
npm run build
to create a build. - ESLint: keeping a code style is good, cool and helps the team to follow a standard, avoiding unexpected bugs. Using
airbnb-base
here, runnpm run lint
to check style fixes, ornpm run lint:fix
to fix them. - Prettier: code formatter using ESlint rules established before. On save (if you're running VSCode).
- Commitlint: a convention for commiting properly. Combined with Husky, pre-checks commits before pushing via hooks.
- Jest: testing framework. Using TDD with every small feature grants a healthy and well-paced progress of the project.
- Express: server framework. To provide service as a server, exposing routes over the internet to interact with the application.
- Docker: deploying container. For deploying the app in a closed environment, production ready.
- CircleCI: CI/CD tool. On every commit over
main
branch, run the tests, and if they go as expected, build the app for production in a docker and pushes it to docker hub. - Heroku: deploying environment.
- add readme
- init project
- set testing env
- add martian-robots logic
- add prettier format command
- add pre-commit hook format command
- Dockerize project
- Expose API endpoints to explore Mars
- add Docs
- add CICD