part3-notes-backend's People
Forkers
ob2code willistieu eryisan beau-haldane metalwings001 agung037 pragathiyp papersson simongreenwood anayib mitchjans altunadem kkiilas hcsc418-2021 sbstn7 jacobchuaziska motimoukari orian-e tuomasrinkineva rtanudjaja omid-web glopzel zhuima anteroa luizapjunior laura-webber st-c0nst rakakroma lsy3 mantylah91 sergioruizsan chrisamrl dakoro sashaiwan matthewchao mmetwally0 bayesss oliviahorjamo iuhmirza radchristy daydy225 stephencubicle akshaybagai chrisheadgrub eliasdev99 theglyph935 leprecon73 micron818 ngonium davidhurtadodev beto-ales hamdi-karim rasmushy mstath1s eveliih mosh-pirk tish77 jcorp11 coqelz anonymousmiked gabegrieve tahasafdari houssamelm sing04 otarza pmugasa godzl webgururobin onzfonz yiwen4 carlostighe boklino theojoha edward-nn zzsealy markal84 durden20 ctlaltdieliet trandangtuan212001 luise8 juliankrzysiak suprame4 alfwred c-shubh howardchan0920 owaisad willcrockett vmneva jhuang007007 marcguay kaiserjagger mocnyjakub juandev01 verajs philippgraf11 kohwdev lahvei vkats90 pdd1996 jaydesignspart3-notes-backend's Issues
[Bug] - Getting Error while get a note
Description of the problem
- Error - Terminal throw an error : “ Cannot set headers after they are sent to the client ” when i use GET method to get a note
- Solution - delete response.json(note)
- Screenshot of the error
// Error Code
app.get('/api/notes/:id', (request, response) => {
const id = Number(request.params.id)
const note = notes.find(note => note.id === id)
if (note) {
response.json(note)
} else {
response.status(404).end()
}
// delete this line
response.json(note)
})
// Solution
app.get('/api/notes/:id', (request, response) => {
const id = Number(request.params.id)
const note = notes.find(note => note.id === id)
if (note) {
response.json(note)
}
if(!note){
response.status(404).end()
}
})
Reproduction Repo:
null
Node Version:
v16.19.1
Platform and Version:
win 11 22H2
Other
Good morning, teacher
I am a JavaScript learner from China,thanks for your open source projects and translate it in chinese,I gain a lot. that why I yearn for your university. however, I didn't study hard in college,my GPA is low now, so I can't apply to your university. this is my first official writing issue,if there are any problems, please point them out and provide information in the correct format, I will modify it next time. If you come to Hang Zhou(Zhe Jiang) to play,I will welcome you warmly.
Yours
China student
2023.5.10
about close close db connection
Is it better to put the close database operation in Promise finally?
Person
.find({})
.then(persons=> {
// ...
mongoose.connection.close()
})
Script build:ui - All branches
Vite build in a directory named "dist"
Need to change the build:ui script in all branches from :
"build:ui": "rm -rf build && cd ../frontend/ && npm run build && cp -r build ../backend"
into :
"build:ui": "rm -rf dist && cd ../frontend/ && npm run build && cp -r dist ../backend",
no put endpoint by section 3-b
Hi! Thanks for the great course
In this section we deploy our notes app to the internet:
https://fullstackopen.com/en/part3/deploying_app_to_internet
At this point however, the notes app has a bug. There is no PUT endpoint declared, and as a result whenever the user presses the 'make (not) important' button, it simply deletes the note
Can't see db.json content
I can't see db.json content using a new path in the baseUrl variable, the last path was '/notes', then we need to change it to '/api/notes', but with this url path I can't see the content.
I already visited the '/api/notes' url and only shows and empty object.
If I visit the last url '/notes' I can see them...
How to solve this problem?
Create a README file.
Please create a ReadMe file with short texts about the project and each branches.
Some basic commands regarding git and npm.
I would like to add one if assigned.
confusing
this part from part4, User administration, Creating a new note made me really confused. I ended up just skipping it.:
The note scheme will also need to change as follows in our models/note.js file:
const noteSchema = new mongoose.Schema({
content: {
type: String,
minLength: 5,
required: true,
},
important: Boolean,
user: String,})
Maybe I didnt understand something important or maybe this is worth looking over why this part is here?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.