https://github.com/cal-dev-lab/rest-crud-api
A custom-built REST API with CRUD functionality.
https://github.com/cal-dev-lab/rest-crud-api
express javascript mongo nodejs prisma typescript
Last synced: 3 months ago
JSON representation
A custom-built REST API with CRUD functionality.
- Host: GitHub
- URL: https://github.com/cal-dev-lab/rest-crud-api
- Owner: cal-dev-lab
- Created: 2024-12-01T15:46:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-07T23:14:57.000Z (over 1 year ago)
- Last Synced: 2025-03-17T00:14:20.533Z (over 1 year ago)
- Topics: express, javascript, mongo, nodejs, prisma, typescript
- Language: TypeScript
- Homepage: https://rest-crud-api.onrender.com/
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [WIP] Custom REST API
### WITH CRUD FUNCTIONALITY
I have made this custom API with NodeJS, TypeScript, Express, Mongo (Atlas) and Prisma.
This will be a demo API with working functionality. This is deployed on Render, it has limited compute hours so please do not abuse this external API URL.
## Getting Started
If you would like to play with the code, please feel free to clone this repo and do with it to your hearts content.
Start by running either `yarn install` or `npm install`(or any other package manager you may use).
To run the server, please use `yarn dev` or `npm run dev`.
Any changes made to the `prisma.schema` file, please remember to run: `npx prisma generate` and `npx prisma db push`.
## Important
I am using environment variables to protect my Mongo database. To use this please create a `.env` file in the project root and add the following:
`DATABASE_URL`: Your database URL. If you use anything other than Mongo, please also update the `prisma.schema` file to match.
`PORT`: Your port of choice. I typically use 1337.
When using this APIs external URL, please allow time for it to spin up (up to 50s) as the server will spin down if there is any inactivity.
## Available Routes
| Method | Route | Description |
| ------ | ----- | ----------- |
| GET | /users | Get all users. |
| GET | /users/:id | Get user by id. |
| POST | /users | Create user. |
| PUT | /users/:id | Update user by id. |
| DELETE | /users/:id | Delete user by id. |
## Let's Connect
If you have any questions about this project, want to collab or anything in general, feel free to get in touch!