https://github.com/smakosh/not-todo-api
REST API for my Gatsby talk about building static & dynamic apps with Gatsby
https://github.com/smakosh/not-todo-api
Last synced: 7 months ago
JSON representation
REST API for my Gatsby talk about building static & dynamic apps with Gatsby
- Host: GitHub
- URL: https://github.com/smakosh/not-todo-api
- Owner: smakosh
- Created: 2019-05-14T06:45:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-14T06:59:28.000Z (over 6 years ago)
- Last Synced: 2025-02-28T19:16:46.504Z (7 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 6
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Not Todo REST API for my Gatsby talk
[Gatsby Talk](https://building-apps-with-gatsby.netlify.com/)
[Gatsby App](https://github.com/smakosh/gatsby-app-starter-rest-api)## Prerequisites
- Node Js
- MongoDB InstalledPlease create a new file `.env` and put these env variables
```bash
DB=mongodb://localhost:27017/todo
SECRET_KEY=NSA
REACT_APP_URL=http://localhost:8000 // when cors is enabled, this will be the only origin to send requests
```## Installing
Installing the dependencies
```bash
npm i
```## Start your mongodb database
```bash
npm run database
```## Start the dev server
```bash
npm run dev
```## Models
User:
- username
- password
- tokensPost:
- title
- isDone
- date
- _creator## Routes
- User
```bash
POST /api/user/register
// Register a new user and returns user data with the generated token
// PublicPOST /api/user/login
// Login user and returns user data with the generated token
// PublicGET /api/user/verify
// Verifies token and returns current user data
// PrivateDELETE /api/user/logout
// Logout
// Private
```- Post
```bash
POST /api/post
// Create a new post
// PrivateGET /api/post/all
// Get all the postsGET /api/post/:id
// Get Post by ID
// PrivateDELETE /api/post/:id
// Delete Post by ID
// PrivatePATCH /api/post/:id
// Update a post
// Private
```## Built with
- Express Js
- MongoDB & Mongoose
- And these useful of JavaScript libraries [package.json](package.json)## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Support
If you love this Gatsby template and want to support me, you can do so through my Patreon
[](https://www.patreon.com/smakosh)