A simple server that can recieve and serve JSON.
- Install the dependencies by running
npm install. - Create a file called
.envthat contains all the necessary environment variables, in this case API_USER (the username) and API_PASS (the password). These are being used to authenticate the POST requests with basic auth. It should look like this:
API_USER=your_username
API_PASS=your_password
- To start the server for development, run
npm run dev. This will start nodemon, which monitors any file changes and automatically restarts the server (very handy for development). To start the server for production, runnpm start.
Both the production and the development server will listen onport 5000by default.