Implement Web APIs to manage your projects for portfolio!
This challenge assume that you have a GitHub account and there is a server hosted by Heroku. Before you start this challenge, please make a GitHub account and make a new Heroku application for this challenge.
If you don't have GitHub account, please take this challenge and make your own GitHub account! https://app.code-check.io/orgs/codecheck_official/challenges/70
If you are not familiar with deploy in Heroku, choose one framework that you want to use and take a challenge from below.
- Django: https://app.code-check.io/orgs/codecheck_official/challenges/71
- Node.js: https://app.code-check.io/orgs/codecheck_official/challenges/69
- Laravel: https://app.code-check.io/orgs/codecheck_official/challenges/73
- Ruby on Rails: https://app.code-check.io/orgs/codecheck_official/challenges/75
- Spring: https://app.code-check.io/orgs/codecheck_official/challenges/72
Information for this challenge is specified in below. It is also provided in database.sql file.
-- This file is formatted based on SQLite3's syntax
-- Some small fixes might be needed to use in other database.
create table projects (
id integer PRIMARY KEY AUTOINCREMENT,
url varchar(255) NULL,
title varchar(255) NOT NULL,
description text NOT NULL,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
);
Open account.json and edit the value for heroku_appname
to the application that you have hosted.
{
"heroku_appname": "<App Name>"
}
Replace <App Name>
, including <
and >
, to your application name.
We require to implement 4 endpoints. All details of specifications are written in files with format of api-first-spec.
- GET /api/projects
- Return
200 OK
status code when server succeed to get data - GET /api/projects spec
- Return
- POST /api/projects
- Return
400 BadRequest
when either of title or description was empty - Return
200 OK
when server succeed to create new data - POST /api/projects spec
- Return
- GET /api/projects/:id
- Return
200 OK
when found data - Return
404 NotFound
when data didn't exists - GET /api/projects/:id spec
- Return
- DELETE /api/projects/:id
- Return
200 OK
when data was successfully deleted - Return
404 NofFound
when data didn't exists - GET /api/projects/:id spec
- Return
To test your API server in local environment, run commands in below.
$ npm install # Install modules (You need run this at first time)
$ $(npm bin)/mocha specifications/localhost # Run Test in local
Make all test status as passing
; there are several failing tests at beginning.
42 passing (16s)
6 failing