youkitouma / codecheck-1009

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make your own portfolio!

Implement Web APIs to manage your projects for portfolio!

Requirements

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.

Database

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
  );

Step 1: Edit account.json

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.

Step 2: Implement your server and check with Test!

We require to implement 4 endpoints. All details of specifications are written in files with format of api-first-spec.

  • GET /api/projects
  • 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
  • GET /api/projects/:id
  • DELETE /api/projects/:id

Run Test

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

About


Languages

Language:JavaScript 100.0%