mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
* add frontmatter to BlitzJS starter * add frontmatter to all starters * add plugins and envVars * fix envVars formatting * fix key for defaultValue in envVars * remove unused frontmatter
title, description, tags
| title | description | tags | ||||
|---|---|---|---|---|---|---|
| ExpressJS Mongoose | An ExpressJS server that connects to a MongoDB database |
|
ExpressJS Mongoose Example
This example starts an ExpressJS server that connects to a Railway MongoDB database using MongooseJS
✨ 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
GETroute -/countrieswhich returns all the countries - A
POSTroute -/countrieswhich can be used to add a new country
Example post request to add a new country:
curl -H "Content-Type: application/json" \
--request POST \
-d '{"name":"India","iso2code":"IN"}' \
http://localhost:3333/countries