Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rtpa25/learnify-server
https://github.com/rtpa25/learnify-server
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/rtpa25/learnify-server
- Owner: rtpa25
- Created: 2022-07-22T01:40:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-21T06:33:10.000Z (over 2 years ago)
- Last Synced: 2024-10-17T00:58:05.703Z (3 months ago)
- Language: TypeScript
- Size: 73.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: ExpressJS Mongoose
description: An ExpressJS server that connects to a MongoDB database
tags:
- express
- mongodb
- mongoose
- typescript
---# ExpressJS Mongoose Example
This example starts an [ExpressJS](https://expressjs.com/) server that connects to a Railway MongoDB database using [MongooseJS](https://mongoosejs.com/)
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fexpressjs-mongoose&plugins=mongodb)
## ✨ Features
- Express
- TypeScript
- MongoDB with Mongoose## 💁♀️ How to use
- Install dependencies `yarn`
- Connect to your Railway project `railway link`
- Start the development server `railway run yarn dev`## 📝 Notes
The starter contains a single `Country` model that you can read from and write to.
There are two main routes on the server:
- A `GET` route - `/countries` which returns all the countries
- A `POST` route - `/countries` which can be used to add a new countryExample post request to add a new country:
```
curl -H "Content-Type: application/json" \
--request POST \
-d '{"name":"India","iso2code":"IN"}' \
http://localhost:3333/countries
```