Skip to content

Rest API

Vinicius Reif Biavatti edited this page Jan 20, 2020 · 3 revisions

This is just a step to configure the ExpressJS depencency. In our entrypoint file index.js, we will import the dependencies we need and configure the Rest API to listen some port:

// Import
const express = require('express');

// Express
let app = express();
app.listen(3000, () => console.log('Express running on port 3000'));

Let's configure the start command for NPM to test out API. For it, open the package.json file and add this key in the scripts session:

"scripts": {
    "start": "node src/index.js"
}

So now, open the command line in the project root folder and just type $ npm start.

It is all for this step! Easy isn't it? In the next step we will introduce the basic of GraphQL schemas.

Clone this wiki locally